Gautam
2010-Mar-30 23:36 UTC
undefined method `abc_notice_path'' for #<ActionView::Base:0xed65220>
Please help me in solving an issue. I wonder why i am getting this error. This method is defined in a controller which was generated through scaffolding and other functions that were created are working fine. Please help me. I am a novice to rails. Any help will be highly appreciated. I am getting the following error when trying to link a method in a view so that it can be called on that very object(id). undefined method `abc_notice_path'' for #<ActionView::Base:0xed65220> Extracted source (around line #25): 22: <%= link_to ''Edit'', edit_notice_path(@notice) %> | 23: <%= link_to ''Back'', notices_path %> 24: | 25: <%= link_to ''Save'', abc_notice_path(@notice) %> Here is the code for my method. def abc @notice = Notice.find(params[:id]) #f = File.new("#{RAILS_ROOT}/public/jar/notice.txt","w") #f.write @notice.title #f.write @notice.body #f.write @notice.user_name #f.close #send_file("#{RAILS_ROOT}/public/jar/notice.txt") end -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung
2010-Mar-31 11:00 UTC
Re: undefined method `abc_notice_path'' for #<ActionView::Base:0xed65220>
On Mar 31, 12:36 am, Gautam <gdham...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Please help me in solving an issue. > I wonder why i am getting this error. This method is defined in a > controller which was generated through scaffolding and other functions > that were created are working fine. > Please help me. I am a novice to rails. Any help will be highly > appreciated. > > I am getting the following error when trying to link a method in a > view so that it can be called on that very object(id). > > undefined method `abc_notice_path'' for #<ActionView::Base:0xed65220> >The *_path helpers are created for you from your config/routes.rb file. Have you added abc as a member action on the notices collection ? Fred> Extracted source (around line #25): > > 22: <%= link_to ''Edit'', edit_notice_path(@notice) %> | > 23: <%= link_to ''Back'', notices_path %> > 24: | > 25: <%= link_to ''Save'', abc_notice_path(@notice) %> > > Here is the code for my method. > > def abc > @notice = Notice.find(params[:id]) > #f = File.new("#{RAILS_ROOT}/public/jar/notice.txt","w") > #f.write @notice.title > #f.write @notice.body > #f.write @notice.user_name > #f.close > #send_file("#{RAILS_ROOT}/public/jar/notice.txt") > end-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Gautam
2010-Mar-31 15:40 UTC
Re: undefined method `abc_notice_path'' for #<ActionView::Base:0xed65220>
Thanks for your kind reply. Here is the code of my routes.rb file Please suggest corrections, if any... map.resources :notices map.resources :users, :has_many => :notices map.resource :session map.connect '':controller/:action/:id'' map.connect '':controller/:action/:id.:format'' map.connect ''/notices/:id/:abc'', :controller => "notices", :action => "abc" map.root :controller=> ''welcome'' map.signup ''/signup'', :controller => ''users'', :action => ''new'' map.login ''/login'', :controller => ''sessions'', :action => ''new'' map.logout ''/logout'', :controller => ''sessions'', :action => ''destroy'' map.create ''/create'', :controller => ''notices'', :action => ''new'' -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung
2010-Mar-31 16:20 UTC
Re: undefined method `abc_notice_path'' for #<ActionView::Base:0xed65220>
On Mar 31, 4:40 pm, Gautam <gdham...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thanks for your kind reply. > Here is the code of my routes.rb file > Please suggest corrections, if any... >Take a look at http://guides.rubyonrails.org/routing.html#adding-more-restful-actions Fred> map.resources :notices > map.resources :users, :has_many => :notices > map.resource :session > > map.connect '':controller/:action/:id'' > map.connect '':controller/:action/:id.:format'' > map.connect ''/notices/:id/:abc'', :controller => "notices", :action > => "abc" > > map.root :controller=> ''welcome'' > map.signup ''/signup'', :controller => ''users'', :action => ''new'' > map.login ''/login'', :controller => ''sessions'', :action => ''new'' > map.logout ''/logout'', :controller => ''sessions'', :action => > ''destroy'' > map.create ''/create'', :controller => ''notices'', :action => ''new''-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.