Hello, 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 http://127.0.0.1:3000/scann/query 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 /Users/montx/.gem/ruby/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:1528:in `find_one'' /Users/montx/.gem/ruby/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:1511:in `find_from_ids'' /Users/montx/.gem/ruby/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:590:in `find'' app/controllers/scanns_controller.rb:21:in `show'' app/controllers/application.rb:42:in `login_required'' ... If for example I put an undefined action: http://127.0.0.1:3000/scann/q5645343 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 ... :-( thanks, r. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Mon, Jan 19, 2009 at 11:19 AM, Raimon Fs <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hello, > > 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 > > http://127.0.0.1:3000/scann/query > > I''m getting an error, and the method who is trapping is ''show''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. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Franz Strebel wrote:> On Mon, Jan 19, 2009 at 11:19 AM, Raimon Fs > <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> >> http://127.0.0.1:3000/scann/query >> >> I''m getting an error, and the method who is trapping is ''show'' > > 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.I also added the lines as you said, the same problem, and also tried with: map.resources :scanns, :member => { :query => :any } In this case, what I want is to show a page with a form for enter data and later query the database. I could make it work with other Rails versions but not with the last one ... What can be wrong ??? thanks, r. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Mon, Jan 19, 2009 at 4:12 PM, Raimon Fs <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I also added the lines as you said, the same problem, and also tried > with: > > map.resources :scanns, :member => { :query => :any } > > In this case, what I want is to show a page with a form for enter data > and later query the database. > > I could make it work with other Rails versions but not with the last one > ... > > What can be wrong ???Can you post the result of rake routes ? --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''m having a similar issue. I have a controlle/model in for Appointment with a new action :cancel When I create a link_to tag (tried may different ways...assigning cancel_appointment_path(appointment) and assigning :controller => :appointment, :action => :cancel, id: => appointment.id ), but I''m getting an error no matter how I try. Assuming we''re using an appointment with id 7.. I get a path /appointments/7/cancel and an error saying action "7" not found...logs show it''s looking for action 7 and trying to pass in id of "cancel". Any advice would be greatly appreciated!!! Thx. -David Franz Strebel wrote:> On Mon, Jan 19, 2009 at 4:12 PM, Raimon Fs > <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> >> What can be wrong ??? > > Can you post the result of rake routes ?-- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi -- On Mon, 19 Jan 2009, Raimon Fs wrote:> > Franz Strebel wrote: >> On Mon, Jan 19, 2009 at 11:19 AM, Raimon Fs >> <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >>> >>> http://127.0.0.1:3000/scann/query >>> >>> I''m getting an error, and the method who is trapping is ''show'' >> >> 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. > > I also added the lines as you said, the same problem, and also tried > with: > > map.resources :scanns, :member => { :query => :any } > > In this case, what I want is to show a page with a form for enter data > and later query the database. > > I could make it work with other Rails versions but not with the last one > ... > > What can be wrong ???Can you give the output of: ruby script/about from your application directory? David -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Coming in 2009: The Well-Grounded Rubyist (http://manning.com/black2) http://www.wishsight.com => Independent, social wishlist management! --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Just realized you''d asked for routes... here''s what I have (showing just those for cancel closing...can post others if you wish). cancel_closing POST /closing/cancel {:controller=>"closings", :action=>"cancel"} formatted_cancel_closing POST /closing/cancel.:format {:controller=>"closings", :action=>"cancel"} in my routes.rb I have the line for adding the method as map.resources :closings, :member => { :cancel => :post }, :requirements => {:protocol => ROUTES_PROTOCOL} Hope that helps give a bit more context. -David David Colwell wrote:> I''m having a similar issue. > > I have a controlle/model > in for Appointment with a new action :cancel > > When I create a link_to tag (tried may different ways...assigning > cancel_appointment_path(appointment) and assigning :controller => > :appointment, :action => :cancel, id: => appointment.id ), but I''m > getting an error no matter how I try. Assuming we''re using an > appointment with id 7.. I get a path /appointments/7/cancel and an error > saying action "7" not found...logs show it''s looking for action 7 and > trying to pass in id of "cancel". > > Any advice would be greatly appreciated!!! > > Thx. -David > > Franz Strebel wrote: >> On Mon, Jan 19, 2009 at 4:12 PM, Raimon Fs >> <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >>> >>> What can be wrong ??? >> >> Can you post the result of rake routes ?-- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
David 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 David A. Black wrote:> Hi -- > > On Mon, 19 Jan 2009, Raimon Fs wrote: > >>> have map.resources :scanns in your routes.rb >> >> >> What can be wrong ??? > > Can you give the output of: > > ruby script/about > > from your application directory? > > > David > > -- > David A. Black / Ruby Power and Light, LLC > Ruby/Rails consulting & training: http://www.rubypal.com > Coming in 2009: The Well-Grounded Rubyist (http://manning.com/black2) > > http://www.wishsight.com => Independent, social wishlist management!-- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
David, 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 appointments_controller? Rick On Jan 21, 7:16 am, David Colwell <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Just realized you''d asked for routes... here''s what I have (showing > just those for cancel closing...can post others if you wish). > > cancel_closing POST /closing/cancel > {:controller=>"closings", :action=>"cancel"} > > formatted_cancel_closing POST /closing/cancel.:format > {:controller=>"closings", :action=>"cancel"} > > in my routes.rb I have the line for adding the method as > map.resources :closings, :member => { :cancel => :post }, :requirements > => {:protocol => ROUTES_PROTOCOL} > > Hope that helps give a bit more context. > > -David > > > > David Colwell wrote: > > I''m having a similar issue. > > > I have a controlle/model > > in for Appointment with a new action :cancel > > > When I create a link_to tag (tried may different ways...assigning > > cancel_appointment_path(appointment) and assigning :controller => > > :appointment, :action => :cancel, id: => appointment.id ), but I''m > > getting an error no matter how I try. Assuming we''re using an > > appointment with id 7.. I get a path /appointments/7/cancel and an error > > saying action "7" not found...logs show it''s looking for action 7 and > > trying to pass in id of "cancel". > > > Any advice would be greatly appreciated!!! > > > Thx. -David > > > Franz Strebel wrote: > >> On Mon, Jan 19, 2009 at 4:12 PM, Raimon Fs > >> <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > > >>> What can be wrong ??? > > >> Can you post the result of rake routes ? > > -- > Posted viahttp://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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 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 -~----------~----~----~----~------~----~------~--~---
Rick, 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?'' %> So Rick wrote:> David, > > 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 > appointments_controller? > > Rick > > On Jan 21, 7:16�am, David Colwell <rails-mailing-l...@andreas-s.net>-- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 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 -~----------~----~----~----~------~----~------~--~---