routes question


I'm stucked in a completely newbie question ...

I have one controller scann

all the default methods work: index, new, save, ...

I added a new one called query, and when I try to call it

I'm getting an error, and the method who is trapping is 'show'

ActiveRecord::RecordNotFound in ScannsController#show

Couldn't find Scann with ID=query
RAILS_ROOT: /Users/montx/Documents/Ruby/scanner

Application Trace | Framework Trace | Full Trace
app/controllers/scanns_controller.rb:21:in `show'
app/controllers/application.rb:42:in `login_required'

If for example I put an undefined action: is also trying to execute the
'show' action ...

wich route I should add to my routes.rb to allow this action ?

I read mor than twice the Rails Routing from the Outside In and made
some attempts but ...




You'll need to add a new route for your custom action. Assuming you
have map.resources :scanns in your routes.rb

If the action you need will work on a collection:

map.resources :scanns, :collection => { :query => :get }

or if just on a member:

map.resources scanns, :member => { :query => :get }

You'll need to change :get to whatever method you need.

Can you post the result of rake routes ?

Hi --


I ran the ruby script/about command and got

About your application's environment
Ruby version 1.8.6 (i686-darwin9.5.0)
RubyGems version 1.3.1
Rails version 2.2.2
Active Record version 2.2.2
Action Pack version 2.2.2
Active Resource version 2.2.2
Action Mailer version 2.2.2
Active Support version 2.2.2
Application root /Users/dc72/Sites/aa-notary/rapps/aanotarysys
Environment development
Database adapter sqlite3
Database schema version 20090108132513


David A. Black wrote:


Your link_to has a cancel_appointment_path but your routes are all
cancel_closing variants. Do you have any routes in place for the



That was my mistake. Appointment object was recently split into two
objects...and the closing is the one we need to have cancelable now. I
copied my link to from an old view that's not actually being used (my
mistake...sorry for the confusion).

So..the link I'm actually trying to get working is:

<%= link_to 'Cancel', cancel_closing_path(closing), :confirm => 'Are you
sure?' %>


Rick wrote: