Hi guys, the next problem:
I create a controller, (/controllers/rmagick_controller.rb), which have aim to test an captcha
Actions: def download # creates an captcha image def show # show the page where image took place def check # must check right captcha or wrong
views/rmagick/show.html.erb:
<div id="captcha"> <p><%= image_tag download_rmagick_path %></p>
<p><% form_tag check_rmagick_path do %> <p><%= text_field_tag :captcha %></p> <p><%= submit_tag "Submit" %></p> <% end %> </p> </div>
config/routes.rb:
resources :rmagick do get "download", :on => :member get "check", :on => :member end
So, there are 2 problems:
1) Routes problem. If I'm write in config/routes.rb something like this:
get "rmagick/show" get "rmagick/download" get "rmagick/check"
I catch this output:
No route matches {:action=>"download", :controller=>"rmagick"}
But I'm place get "rmagick/download" in routes.rb. Why it doesn't work? (it can't find download_rmagick_path)
So, if I use resources :rmagick do ... I see an show.html.erb when i write something other than "show" text, ie in this link 127.0.0.1:3000/rmagick/jjvniuv I also will see show action.why? How I can change this? Where is the problem?
2) Problem with form_tag. So, you see the code above. When I put captcha value and press "submit" button, I don't go to rmagick/check, I go to rmagick/show/check. Why?
3) When I'll create all of this, how I can do interaction between other pages and captcha?