Wednesday, September 21, 2011

[Rails] custom action in Rails 3

Hi, everyone. I'm working on a program in Rails 3.0.10 and it has a
custom action, "run_files", that extracts data in files and saves it in
database. When I clicked the link on the page, it returned an error
page:
ActiveRecord::RecordNotFound in ReportsController#show
Couldn't find Report with ID=run_files

I wonder why Rails rendered show instead of the custom action.
Following is the view file, route file and the output of rake routes.

index.html.erb
<%= link_to "Process Files", :controller => 'reports', :action =>
'run_files' %>

routes.rb
match "reports/run_files" => "reports#run_files", :via => :post
resources :reports

output of rake routes
reports_run_files POST /reports/run_files(.:format)
{:controller=>"reports"
, :action=>"run_files"}
...
..

Thanks in advance.

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate