私は次のことを達成しようとしています:
ユーザーが のフォームに 5 桁の ID をwww.something.com
入力すると、ユーザーは にリダイレクトされwww.something.com/obtain/(5 digit ID)
ます。
URL を手動で入力するwww.something.com/obtain/(5 digit ID)
と目的のアクションがトリガーされることはわかっていますが、代わりにそれを行うフォームを作成するにはどうすればよいですか?
とにかくこれを達成できる方法はあります<%= form_tag .... %>
か?
レーキルートには次のエントリがあります
取得 /obtain/:pid(.:format) products#obtain {:id=>/\d+/}
現在コントローラーに
def obtain
scrapy = Scraper.new
@product = scrapy.scrape((params[:pid]))
if @product
redirect_to @product, notice: 'Product successfully updated'
elsif
redirect_to root_path, notice: 'Invalid product requested'
end
end