Hi, Ive recently bene trying to find a way to edit my tutorials (which are stored inside categories) in my RoR app. To edit my category''s names I use the following in the category show file: <%= link_to ''Edit'', edit_category_path(@category) %> And this is edit in the categories controller: def edit @category = Category.find(params[:id]) end but when I change this to tutorials: <%= link_to ''Edit'', edit_tutorial_path(@tutorial) %> and def edit @tutorial = Tutorial.find(params[:id]) end I get this error on the tutorial show page: undefined method `edit_tutorial_path'' for #<ActionView::Base: 0x5ce52fc> (or something of those origins) I had the origional category system setup for me, so I dont know that much about how the categories are editable. Therefore its hard for me to figure out how to edit the tutorials. Please Help, (If you need any more information please just ask), Thanks In Advance, Joe
What do you mean your tutorials "are stored inside categories?" Also: rake routes -eric On Sep 24, 11:09 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote:> Hi, Ive recently bene trying to find a way to edit my tutorials (which > are stored inside categories) in my RoR app. To edit my category''s > names I use the following in the category show file: > > <%= link_to ''Edit'', edit_category_path(@category) %> > > And this is edit in the categories controller: > > def edit > @category = Category.find(params[:id]) > end > > but when I change this to tutorials: > > <%= link_to ''Edit'', edit_tutorial_path(@tutorial) %> > > and > > def edit > @tutorial = Tutorial.find(params[:id]) > end > > I get this error on the tutorial show page: > > undefined method `edit_tutorial_path'' for #<ActionView::Base: > 0x5ce52fc> > > (or something of those origins) > > I had the origional category system setup for me, so I dont know that > much about how the categories are editable. Therefore its hard for me > to figure out how to edit the tutorials. > > Please Help, > > (If you need any more information please just ask), > > Thanks In Advance, > > Joe
categories GET /categories(.:format) POST /categories(.:format) new_category GET /categories/new(.:format) edit_category GET /categories/:id/edit(.:format) category GET /categories/:id(.:format) PUT /categories /categories/:id(.:format) DELETE /categories/:id(.:format) category_tutorials GET /categories/:category_id/tutorials(.:format) POST /categories/:category_id/tutorials (.:format) new_category_tutorial GET /categories/:category_id/tutorials/new (.:format) edit_category_tutorial GET /categories/:category_id/tutorials/:id/edit (.:format) category_tutorial;_tutorial GET /categories/:category_id/tutorials/:id (.:format) PUT /categories/:category_id/tutorials/:id (.:format) DELETE /categories/:category_id/tutorials/:id(.:format) I think thats the most of the important bit, heres a screen shot of the console: http://i603.photobucket.com/albums/tt118/Joesavage1/Console.jpg Thnks In advance, Joe On Sep 24, 7:47 pm, Eric <ericgh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> What do you mean your tutorials "are stored inside categories?" > > Also: rake routes > > -eric > > On Sep 24, 11:09 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > Hi, Ive recently bene trying to find a way to edit my tutorials (which > > are stored inside categories) in my RoR app. To edit my category''s > > names I use the following in the category show file: > > > <%= link_to ''Edit'', edit_category_path(@category) %> > > > And this is edit in the categories controller: > > > def edit > > @category = Category.find(params[:id]) > > end > > > but when I change this to tutorials: > > > <%= link_to ''Edit'', edit_tutorial_path(@tutorial) %> > > > and > > > def edit > > @tutorial = Tutorial.find(params[:id]) > > end > > > I get this error on the tutorial show page: > > > undefined method `edit_tutorial_path'' for #<ActionView::Base: > > 0x5ce52fc> > > > (or something of those origins) > > > I had the origional category system setup for me, so I dont know that > > much about how the categories are editable. Therefore its hard for me > > to figure out how to edit the tutorials. > > > Please Help, > > > (If you need any more information please just ask), > > > Thanks In Advance, > > > Joe
Hi Joe, On Thu, 2009-09-24 at 22:54 -0700, Joe wrote:> edit_category GET /categories/:id/edit(.:format)> edit_category_tutorial GET /categories/:category_id/tutorials/:id/edit > (.:format)> > > > On Sep 24, 11:09 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > >> > > <%= link_to ''Edit'', edit_category_path(@category) %> > >> > > > > but when I change this to tutorials: > > > > > <%= link_to ''Edit'', edit_tutorial_path(@tutorial) %> > >> > > I get this error on the tutorial show page: > > > > > undefined method `edit_tutorial_path'' for #<ActionView::Base: > > > 0x5ce52fc>It looks like you just need to use the correct route which, it appears, is named: edit_category_tutorial_path HTH, Bill
Then I get this error on the tutorial show page: edit_category_tutorial_url failed to generate from {:action=>"edit", :controller=>"tutorials", :category_id=>#<Tutorial id: 14, category_id: 1, name: "The tutorials name", content: "the tutorials content", created_at: "2009-09-21 15:55:54", updated_at: "2009-09-21 15:55:54">}, expected: {:action=>"edit", :controller=>"tutorials"}, diff: {:category_id=>#<Tutorial id: 14, category_id: 1, name: "The Tutorial Name", content: "The tutorials content", created_at: "2009-09-21 15:55:54", updated_at: "2009-09-21 15:55:54">} On Sep 25, 9:11 am, bill walton <bwalton...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Joe, > > > > On Thu, 2009-09-24 at 22:54 -0700, Joe wrote: > > edit_category GET /categories/:id/edit(.:format) > > edit_category_tutorial GET /categories/:category_id/tutorials/:id/edit > > (.:format) > > > > On Sep 24, 11:09 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > <%= link_to ''Edit'', edit_category_path(@category) %> > > > > > but when I change this to tutorials: > > > > > <%= link_to ''Edit'', edit_tutorial_path(@tutorial) %> > > > > > I get this error on the tutorial show page: > > > > > undefined method `edit_tutorial_path'' for #<ActionView::Base: > > > > 0x5ce52fc> > > It looks like you just need to use the correct route which, it appears, > is named: > > edit_category_tutorial_path > > HTH, > Bill
Any1?? (Soz for bump, im just RLLY desperate to fix) On Sep 25, 6:02 pm, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote:> Then I get this error on the tutorial show page: > > edit_category_tutorial_url failed to generate from > {:action=>"edit", :controller=>"tutorials", :category_id=>#<Tutorial > id: 14, category_id: 1, name: "The tutorials name", content: "the > tutorials content", created_at: "2009-09-21 15:55:54", updated_at: > "2009-09-21 15:55:54">}, expected: > {:action=>"edit", :controller=>"tutorials"}, diff: > {:category_id=>#<Tutorial id: 14, category_id: 1, name: "The Tutorial > Name", content: "The tutorials content", created_at: "2009-09-21 > 15:55:54", updated_at: "2009-09-21 15:55:54">} > > On Sep 25, 9:11 am, bill walton <bwalton...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi Joe, > > > On Thu, 2009-09-24 at 22:54 -0700, Joe wrote: > > > edit_category GET /categories/:id/edit(.:format) > > > edit_category_tutorial GET /categories/:category_id/tutorials/:id/edit > > > (.:format) > > > > > On Sep 24, 11:09 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > > <%= link_to ''Edit'', edit_category_path(@category) %> > > > > > > but when I change this to tutorials: > > > > > > <%= link_to ''Edit'', edit_tutorial_path(@tutorial) %> > > > > > > I get this error on the tutorial show page: > > > > > > undefined method `edit_tutorial_path'' for #<ActionView::Base: > > > > > 0x5ce52fc> > > > It looks like you just need to use the correct route which, it appears, > > is named: > > > edit_category_tutorial_path > > > HTH, > > Bill
Joe wrote:> Any1??You couldn''t wait 24 hours to bump? You couldn''t bother to type full words? Those two things tend to really annoy those in a position to help.> > (Soz for bump, im just RLLY desperate to fix)Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/.
Marnen is right. You''re not going to get far with people''s help most places if you don''t take the minimal effort to be courteous (or at least stop using "Soz"). You seem to be desperate rather often (http://groups.google.com/group/ rubyonrails-talk/browse_thread/thread/ a25e07d2414e2b32/4bca7399878d02d7#4bca7399878d02d7) and feel the need to bump before 24 hours. I will tell you, there is a way to evaluate / display the path you''re trying to use using script/console. You should also read this: http://api.rubyonrails.org/classes/ActionController/Routing.html R On Sep 26, 7:05 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote:> Any1?? > > (Soz for bump, im just RLLY desperate to fix) > > On Sep 25, 6:02 pm, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > Then I get this error on the tutorial show page: > > > edit_category_tutorial_url failed to generate from > > {:action=>"edit", :controller=>"tutorials", :category_id=>#<Tutorial > > id: 14, category_id: 1, name: "Thetutorialsname", content: "the > >tutorialscontent", created_at: "2009-09-21 15:55:54", updated_at: > > "2009-09-21 15:55:54">}, expected: > > {:action=>"edit", :controller=>"tutorials"}, diff: > > {:category_id=>#<Tutorial id: 14, category_id: 1, name: "The Tutorial > > Name", content: "Thetutorialscontent", created_at: "2009-09-21 > > 15:55:54", updated_at: "2009-09-21 15:55:54">} > > > On Sep 25, 9:11 am, bill walton <bwalton...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hi Joe, > > > > On Thu, 2009-09-24 at 22:54 -0700, Joe wrote: > > > > edit_category GET /categories/:id/edit(.:format) > > > > edit_category_tutorial GET /categories/:category_id/tutorials/:id/edit > > > > (.:format) > > > > > > On Sep 24, 11:09 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > > > <%= link_to ''Edit'', edit_category_path(@category) %> > > > > > > > but when I change this totutorials: > > > > > > > <%= link_to ''Edit'', edit_tutorial_path(@tutorial) %> > > > > > > > I get this error on the tutorial show page: > > > > > > > undefined method `edit_tutorial_path'' for #<ActionView::Base: > > > > > > 0x5ce52fc> > > > > It looks like you just need to use the correct route which, it appears, > > > is named: > > > > edit_category_tutorial_path > > > > HTH, > > > Bill > >
Yes correct I am desperate rather often as I was supposed to only take my site down for a few says to do this and it hs extended onto weeks. I will read the link (although im so bas in RoR im not honestly sure if i''ll understand it), If anyone wants to give a more direct answer please feel free to do so, as the chances are I havnt been able to figure it out. Regards, Joe On Sep 26, 3:01 pm, richardun <richar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Marnen is right. You''re not going to get far with people''s help most > places if you don''t take the minimal effort to be courteous (or at > least stop using "Soz"). > > You seem to be desperate rather often (http://groups.google.com/group/ > rubyonrails-talk/browse_thread/thread/ > a25e07d2414e2b32/4bca7399878d02d7#4bca7399878d02d7) and feel the need > to bump before 24 hours. > > I will tell you, there is a way to evaluate / display the path you''re > trying to use using script/console. You should also read this:http://api.rubyonrails.org/classes/ActionController/Routing.html > > R > > On Sep 26, 7:05 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > Any1?? > > > (Soz for bump, im just RLLY desperate to fix) > > > On Sep 25, 6:02 pm, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > Then I get this error on the tutorial show page: > > > > edit_category_tutorial_url failed to generate from > > > {:action=>"edit", :controller=>"tutorials", :category_id=>#<Tutorial > > > id: 14, category_id: 1, name: "Thetutorialsname", content: "the > > >tutorialscontent", created_at: "2009-09-21 15:55:54", updated_at: > > > "2009-09-21 15:55:54">}, expected: > > > {:action=>"edit", :controller=>"tutorials"}, diff: > > > {:category_id=>#<Tutorial id: 14, category_id: 1, name: "The Tutorial > > > Name", content: "Thetutorialscontent", created_at: "2009-09-21 > > > 15:55:54", updated_at: "2009-09-21 15:55:54">} > > > > On Sep 25, 9:11 am, bill walton <bwalton...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hi Joe, > > > > > On Thu, 2009-09-24 at 22:54 -0700, Joe wrote: > > > > > edit_category GET /categories/:id/edit(.:format) > > > > > edit_category_tutorial GET /categories/:category_id/tutorials/:id/edit > > > > > (.:format) > > > > > > > On Sep 24, 11:09 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > > > > <%= link_to ''Edit'', edit_category_path(@category) %> > > > > > > > > but when I change this totutorials: > > > > > > > > <%= link_to ''Edit'', edit_tutorial_path(@tutorial) %> > > > > > > > > I get this error on the tutorial show page: > > > > > > > > undefined method `edit_tutorial_path'' for #<ActionView::Base: > > > > > > > 0x5ce52fc> > > > > > It looks like you just need to use the correct route which, it appears, > > > > is named: > > > > > edit_category_tutorial_path > > > > > HTH, > > > > Bill
Strangely.. I acctually figured out what was wrong and corrected to: edit_category_tutorial_path(@tutorial_category.id, @tutorial) which seems to lead to the edit page. However I now have an issue on this page, as the form as it was ( <% form_for(@tutorial) do |f| %> ) gives the error: undefined method `tutorial_path'' So I decided logically to change it to: <% form_for (@tutorial_category.id, @tutorial) do |f| %> which gave a fixnum error, which I read was because I used ".id" which is a fixed integer so i changed it to: <% form_for(@tutorial_category, @tutorial) do |f| %> which now gives me the error I cant solve: undefined method `nil_class_path'' for #<ActionView::Base:0x60caf34> (or something of those origins) Please Help me solve this issue, and sorry for my permanent bumping and this time I shall wait until I decide to bump (if I decide to bump atall) Thanks In Advance, Joe On Sep 26, 5:33 pm, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote:> Yes correct I am desperate rather often as I was supposed to only take > my site down for a few says to do this and it hs extended onto weeks. > > I will read the link (although im so bas in RoR im not honestly sure > if i''ll understand it), > > If anyone wants to give a more direct answer please feel free to do > so, as the chances are I havnt been able to figure it out. > > Regards, > > Joe > > On Sep 26, 3:01 pm, richardun <richar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Marnen is right. You''re not going to get far with people''s help most > > places if you don''t take the minimal effort to be courteous (or at > > least stop using "Soz"). > > > You seem to be desperate rather often (http://groups.google.com/group/ > > rubyonrails-talk/browse_thread/thread/ > > a25e07d2414e2b32/4bca7399878d02d7#4bca7399878d02d7) and feel the need > > to bump before 24 hours. > > > I will tell you, there is a way to evaluate / display the path you''re > > trying to use using script/console. You should also read this:http://api.rubyonrails.org/classes/ActionController/Routing.html > > > R > > > On Sep 26, 7:05 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > Any1?? > > > > (Soz for bump, im just RLLY desperate to fix) > > > > On Sep 25, 6:02 pm, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > Then I get this error on the tutorial show page: > > > > > edit_category_tutorial_url failed to generate from > > > > {:action=>"edit", :controller=>"tutorials", :category_id=>#<Tutorial > > > > id: 14, category_id: 1, name: "Thetutorialsname", content: "the > > > >tutorialscontent", created_at: "2009-09-21 15:55:54", updated_at: > > > > "2009-09-21 15:55:54">}, expected: > > > > {:action=>"edit", :controller=>"tutorials"}, diff: > > > > {:category_id=>#<Tutorial id: 14, category_id: 1, name: "The Tutorial > > > > Name", content: "Thetutorialscontent", created_at: "2009-09-21 > > > > 15:55:54", updated_at: "2009-09-21 15:55:54">} > > > > > On Sep 25, 9:11 am, bill walton <bwalton...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > Hi Joe, > > > > > > On Thu, 2009-09-24 at 22:54 -0700, Joe wrote: > > > > > > edit_category GET /categories/:id/edit(.:format) > > > > > > edit_category_tutorial GET /categories/:category_id/tutorials/:id/edit > > > > > > (.:format) > > > > > > > > On Sep 24, 11:09 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > > > > > <%= link_to ''Edit'', edit_category_path(@category) %> > > > > > > > > > but when I change this totutorials: > > > > > > > > > <%= link_to ''Edit'', edit_tutorial_path(@tutorial) %> > > > > > > > > > I get this error on the tutorial show page: > > > > > > > > > undefined method `edit_tutorial_path'' for #<ActionView::Base: > > > > > > > > 0x5ce52fc> > > > > > > It looks like you just need to use the correct route which, it appears, > > > > > is named: > > > > > > edit_category_tutorial_path > > > > > > HTH, > > > > > Bill
Right.. Just maybe figured out another bit of it. I changed: <% form_for(@tutorial_category, @tutorial) do |f| %> to <% form_for(@tutorial.category, @tutorial) do |f| %> and this seems to function properly, however now I have a new issue that ive been working on for hours and still cant figure out how to fix. In the form the category part of it is like this: <%= f.label :category_id %><br /> <%= f.text_field :category_id %> The first label line works fine but I get this error for the next line: undefined method `category_id'' for #<Category:0x5fefc2c> (or something like that) Ive tried every possible combination I can think of with changing category_id all the way to things like tutorial.category_id and allsorts. So this is the first error I cant solve, so i decided to try without it and see if the other features work, well :name seems to work fine, but the next bit (:content) dosn''t work. At the moment its like this: <%= f.label :content %><br /> <%= f.text_area :content %> once again I get the error for the second of the two lines. And this is my second problem that I cant fix, I havnt tried without :content and without :category_id yet so im not sure if the update button works, but I tink these problems should be dealt with first. Regards, and Thanks In Advance, Joe On Sep 26, 6:52 pm, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote:> Strangely.. I acctually figured out what was wrong and corrected to: > edit_category_tutorial_path(@tutorial_category.id, @tutorial) > > which seems to lead to the edit page. However I now have an issue on > this page, as the form as it was ( <% form_for(@tutorial) do |f| %> ) > gives the error: > > undefined method `tutorial_path'' > > So I decided logically to change it to: <% form_for > (@tutorial_category.id, @tutorial) do |f| %> > > which gave a fixnum error, which I read was because I used ".id" > which is a fixed integer so i changed it to: > > <% form_for(@tutorial_category, @tutorial) do |f| %> > > which now gives me the error I cant solve: > > undefined method `nil_class_path'' for #<ActionView::Base:0x60caf34> > > (or something of those origins) > > Please Help me solve this issue, and sorry for my permanent bumping > and this time I shall wait until I decide to bump (if I decide to bump > atall) > > Thanks In Advance, > > Joe > > On Sep 26, 5:33 pm, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > Yes correct I am desperate rather often as I was supposed to only take > > my site down for a few says to do this and it hs extended onto weeks. > > > I will read the link (although im so bas in RoR im not honestly sure > > if i''ll understand it), > > > If anyone wants to give a more direct answer please feel free to do > > so, as the chances are I havnt been able to figure it out. > > > Regards, > > > Joe > > > On Sep 26, 3:01 pm, richardun <richar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Marnen is right. You''re not going to get far with people''s help most > > > places if you don''t take the minimal effort to be courteous (or at > > > least stop using "Soz"). > > > > You seem to be desperate rather often (http://groups.google.com/group/ > > > rubyonrails-talk/browse_thread/thread/ > > > a25e07d2414e2b32/4bca7399878d02d7#4bca7399878d02d7) and feel the need > > > to bump before 24 hours. > > > > I will tell you, there is a way to evaluate / display the path you''re > > > trying to use using script/console. You should also read this:http://api.rubyonrails.org/classes/ActionController/Routing.html > > > > R > > > > On Sep 26, 7:05 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > Any1?? > > > > > (Soz for bump, im just RLLY desperate to fix) > > > > > On Sep 25, 6:02 pm, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > > Then I get this error on the tutorial show page: > > > > > > edit_category_tutorial_url failed to generate from > > > > > {:action=>"edit", :controller=>"tutorials", :category_id=>#<Tutorial > > > > > id: 14, category_id: 1, name: "Thetutorialsname", content: "the > > > > >tutorialscontent", created_at: "2009-09-21 15:55:54", updated_at: > > > > > "2009-09-21 15:55:54">}, expected: > > > > > {:action=>"edit", :controller=>"tutorials"}, diff: > > > > > {:category_id=>#<Tutorial id: 14, category_id: 1, name: "The Tutorial > > > > > Name", content: "Thetutorialscontent", created_at: "2009-09-21 > > > > > 15:55:54", updated_at: "2009-09-21 15:55:54">} > > > > > > On Sep 25, 9:11 am, bill walton <bwalton...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > Hi Joe, > > > > > > > On Thu, 2009-09-24 at 22:54 -0700, Joe wrote: > > > > > > > edit_category GET /categories/:id/edit(.:format) > > > > > > > edit_category_tutorial GET /categories/:category_id/tutorials/:id/edit > > > > > > > (.:format) > > > > > > > > > On Sep 24, 11:09 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > > > > > > <%= link_to ''Edit'', edit_category_path(@category) %> > > > > > > > > > > but when I change this totutorials: > > > > > > > > > > <%= link_to ''Edit'', edit_tutorial_path(@tutorial) %> > > > > > > > > > > I get this error on the tutorial show page: > > > > > > > > > > undefined method `edit_tutorial_path'' for #<ActionView::Base: > > > > > > > > > 0x5ce52fc> > > > > > > > It looks like you just need to use the correct route which, it appears, > > > > > > is named: > > > > > > > edit_category_tutorial_path > > > > > > > HTH, > > > > > > Bill
I know you''ve moved on from the path issue, but to help you in the future, I found something that has helped me figure out paths. One, someone already mentioned, which was: :; rake routes Which you probably already knew. But you can also put a path in that you''re guessing will work and see what the actual URL it converts it to at runtime: :; ruby script/console :; >> include ActionController::UrlWriter :; => Object :; >> sessions_path :; => "/sessions" Also, there are lots of cool helpers / tricks you can use in Rails, like the *_path helper, but I''ve made the mistake of trying to make some of them work during a tight deadline or when there''s high pressure (site down). If this path or url_for thing is giving you issues, you can put in an old school :controller => ''mycontroller'', :action => ''myaction'' to resolve it. If you''re getting undefined method errors in your form, it''s because the "f" is representing an object that doesn''t have methods for the field you''re trying to use. Go to this site: http://railsbrain.com/ View the doc for your rails version and look up: form_for I downloaded and use this site for my dev... it''s extremely helpful. You''re not using form_for correctly. Here are the parameters it takes: form_for(record_or_name_or_array, *args, &proc) So, it''s using the first one, "@tutorial.category" for the main object. Do you have a "content" column in Category? Are you trying to edit Category or tutorial? The error you''re getting shows it''s using a Category object: undefined method `category_id'' for #<Category:0x5fefc2c> for #<Category:0x5fefc2c> indicates it''s using a Category object. Check out the API and use that when you''re not positive about the usage. It''s definitely worth the read, especially in very busy times. Richard On Sep 27, 1:53 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote:> Right.. Just maybe figured out another bit of it. I changed: > > <% form_for(@tutorial_category, @tutorial) do |f| %> > > to > > <% form_for(@tutorial.category, @tutorial) do |f| %> > > and this seems to function properly, however now I have a new issue > that ive been working on for hours and still cant figure out how to > fix. > In the form the category part of it is like this: > > <%= f.label :category_id %><br /> > <%= f.text_field :category_id %> > > The first label line works fine but I get this error for the next > line: > > undefined method `category_id'' for #<Category:0x5fefc2c> > > (or something like that) > > Ive tried every possible combination I can think of with changing > category_id all the way to things like tutorial.category_id and > allsorts. > > So this is the first error I cant solve, so i decided to try without > it and see if the other features work, well :name seems to work fine, > but the next bit (:content) dosn''t work. > > At the moment its like this: > > <%= f.label :content %><br /> > <%= f.text_area :content %> > > once again I get the error for the second of the two lines. > > And this is my second problem that I cant fix, I havnt tried > without :content and without :category_id yet so im not sure if the > update button works, but I tink these problems should be dealt with > first. > > Regards, > > and Thanks In Advance, > > Joe > > On Sep 26, 6:52 pm, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > Strangely.. I acctually figured out what was wrong and corrected to: > > edit_category_tutorial_path(@tutorial_category.id, @tutorial) > > > which seems to lead to the edit page. However I now have an issue on > > this page, as the form as it was ( <% form_for(@tutorial) do |f| %> ) > > gives the error: > > > undefined method `tutorial_path'' > > > So I decided logically to change it to: <% form_for > > (@tutorial_category.id, @tutorial) do |f| %> > > > which gave a fixnum error, which I read was because I used ".id" > > which is a fixed integer so i changed it to: > > > <% form_for(@tutorial_category, @tutorial) do |f| %> > > > which now gives me the error I cant solve: > > > undefined method `nil_class_path'' for #<ActionView::Base:0x60caf34> > > > (or something of those origins) > > > Please Help me solve this issue, and sorry for my permanent bumping > > and this time I shall wait until I decide to bump (if I decide to bump > > atall) > > > Thanks In Advance, > > > Joe > > > On Sep 26, 5:33 pm, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > Yes correct I am desperate rather often as I was supposed to only take > > > my site down for a few says to do this and it hs extended onto weeks. > > > > I will read the link (although im so bas in RoR im not honestly sure > > > if i''ll understand it), > > > > If anyone wants to give a more direct answer please feel free to do > > > so, as the chances are I havnt been able to figure it out. > > > > Regards, > > > > Joe > > > > On Sep 26, 3:01 pm, richardun <richar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Marnen is right. You''re not going to get far with people''s help most > > > > places if you don''t take the minimal effort to be courteous (or at > > > > least stop using "Soz"). > > > > > You seem to be desperate rather often (http://groups.google.com/group/ > > > > rubyonrails-talk/browse_thread/thread/ > > > > a25e07d2414e2b32/4bca7399878d02d7#4bca7399878d02d7) and feel the need > > > > to bump before 24 hours. > > > > > I will tell you, there is a way to evaluate / display the path you''re > > > > trying to use using script/console. You should also read this:http://api.rubyonrails.org/classes/ActionController/Routing.html > > > > > R > > > > > On Sep 26, 7:05 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > > Any1?? > > > > > > (Soz for bump, im just RLLY desperate to fix) > > > > > > On Sep 25, 6:02 pm, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > > > Then I get this error on the tutorial show page: > > > > > > > edit_category_tutorial_url failed to generate from > > > > > > {:action=>"edit", :controller=>"tutorials", :category_id=>#<Tutorial > > > > > > id: 14, category_id: 1, name: "Thetutorialsname", content: "the > > > > > >tutorialscontent", created_at: "2009-09-21 15:55:54", updated_at: > > > > > > "2009-09-21 15:55:54">}, expected: > > > > > > {:action=>"edit", :controller=>"tutorials"}, diff: > > > > > > {:category_id=>#<Tutorial id: 14, category_id: 1, name: "The Tutorial > > > > > > Name", content: "Thetutorialscontent", created_at: "2009-09-21 > > > > > > 15:55:54", updated_at: "2009-09-21 15:55:54">} > > > > > > > On Sep 25, 9:11 am, bill walton <bwalton...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > Hi Joe, > > > > > > > > On Thu, 2009-09-24 at 22:54 -0700, Joe wrote: > > > > > > > > edit_category GET /categories/:id/edit(.:format) > > > > > > > > edit_category_tutorial GET /categories/:category_id/tutorials/:id/edit > > > > > > > > (.:format) > > > > > > > > > > On Sep 24, 11:09 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > > > > > > > <%= link_to ''Edit'', edit_category_path(@category) %> > > > > > > > > > > > but when I change this totutorials: > > > > > > > > > > > <%= link_to ''Edit'', edit_tutorial_path(@tutorial) %> > > > > > > > > > > > I get this error on the tutorial show page: > > > > > > > > > > > undefined method `edit_tutorial_path'' for #<ActionView::Base: > > > > > > > > > > 0x5ce52fc> > > > > > > > > It looks like you just need to use the correct route which, it appears, > > > > > > > is named: > > > > > > > > edit_category_tutorial_path > > > > > > > > HTH, > > > > > > > Bill > >
Im attempting to edit the tutorial and the tutorial does have content and name, not the category. Are the other content bits messing up because i havnt done the form correctly then? If so do you have a more direct response to fix it? as im really not good in rails... Thanks In Advance, Joe On Sep 27, 10:49 pm, richardun <richar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I know you''ve moved on from the path issue, but to help you in the > future, I found something that has helped me figure out paths. One, > someone already mentioned, which was: > > :; rake routes > > Which you probably already knew. But you can also put a path in that > you''re guessing will work and see what the actual URL it converts it > to at runtime: > > :; ruby script/console > :; >> include ActionController::UrlWriter > :; => Object > :; >> sessions_path > :; => "/sessions" > > Also, there are lots of cool helpers / tricks you can use in Rails, > like the *_path helper, but I''ve made the mistake of trying to make > some of them work during a tight deadline or when there''s high > pressure (site down). If this path or url_for thing is giving you > issues, you can put in an old school :controller => > ''mycontroller'', :action => ''myaction'' to resolve it. > > If you''re getting undefined method errors in your form, it''s because > the "f" is representing an object that doesn''t have methods for the > field you''re trying to use. Go to this site: http://railsbrain.com/ > View the doc for your rails version and look up: form_for I > downloaded and use this site for my dev... it''s extremely helpful. > > You''re not using form_for correctly. Here are the parameters it > takes: > > form_for(record_or_name_or_array, *args, &proc) > > So, it''s using the first one, "@tutorial.category" for the main > object. Do you have a "content" column in Category? Are you trying > to edit Category or tutorial? The error you''re getting shows it''s > using a Category object: > > undefined method `category_id'' for #<Category:0x5fefc2c> > > for #<Category:0x5fefc2c> indicates it''s using a Category object. > Check out the API and use that when you''re not positive about the > usage. It''s definitely worth the read, especially in very busy times. > > Richard > > On Sep 27, 1:53 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > Right.. Just maybe figured out another bit of it. I changed: > > > <% form_for(@tutorial_category, @tutorial) do |f| %> > > > to > > > <% form_for(@tutorial.category, @tutorial) do |f| %> > > > and this seems to function properly, however now I have a new issue > > that ive been working on for hours and still cant figure out how to > > fix. > > In the form the category part of it is like this: > > > <%= f.label :category_id %><br /> > > <%= f.text_field :category_id %> > > > The first label line works fine but I get this error for the next > > line: > > > undefined method `category_id'' for #<Category:0x5fefc2c> > > > (or something like that) > > > Ive tried every possible combination I can think of with changing > > category_id all the way to things like tutorial.category_id and > > allsorts. > > > So this is the first error I cant solve, so i decided to try without > > it and see if the other features work, well :name seems to work fine, > > but the next bit (:content) dosn''t work. > > > At the moment its like this: > > > <%= f.label :content %><br /> > > <%= f.text_area :content %> > > > once again I get the error for the second of the two lines. > > > And this is my second problem that I cant fix, I havnt tried > > without :content and without :category_id yet so im not sure if the > > update button works, but I tink these problems should be dealt with > > first. > > > Regards, > > > and Thanks In Advance, > > > Joe > > > On Sep 26, 6:52 pm, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > Strangely.. I acctually figured out what was wrong and corrected to: > > > edit_category_tutorial_path(@tutorial_category.id, @tutorial) > > > > which seems to lead to the edit page. However I now have an issue on > > > this page, as the form as it was ( <% form_for(@tutorial) do |f| %> ) > > > gives the error: > > > > undefined method `tutorial_path'' > > > > So I decided logically to change it to: <% form_for > > > (@tutorial_category.id, @tutorial) do |f| %> > > > > which gave a fixnum error, which I read was because I used ".id" > > > which is a fixed integer so i changed it to: > > > > <% form_for(@tutorial_category, @tutorial) do |f| %> > > > > which now gives me the error I cant solve: > > > > undefined method `nil_class_path'' for #<ActionView::Base:0x60caf34> > > > > (or something of those origins) > > > > Please Help me solve this issue, and sorry for my permanent bumping > > > and this time I shall wait until I decide to bump (if I decide to bump > > > atall) > > > > Thanks In Advance, > > > > Joe > > > > On Sep 26, 5:33 pm, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > Yes correct I am desperate rather often as I was supposed to only take > > > > my site down for a few says to do this and it hs extended onto weeks. > > > > > I will read the link (although im so bas in RoR im not honestly sure > > > > if i''ll understand it), > > > > > If anyone wants to give a more direct answer please feel free to do > > > > so, as the chances are I havnt been able to figure it out. > > > > > Regards, > > > > > Joe > > > > > On Sep 26, 3:01 pm, richardun <richar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > Marnen is right. You''re not going to get far with people''s help most > > > > > places if you don''t take the minimal effort to be courteous (or at > > > > > least stop using "Soz"). > > > > > > You seem to be desperate rather often (http://groups.google.com/group/ > > > > > rubyonrails-talk/browse_thread/thread/ > > > > > a25e07d2414e2b32/4bca7399878d02d7#4bca7399878d02d7) and feel the need > > > > > to bump before 24 hours. > > > > > > I will tell you, there is a way to evaluate / display the path you''re > > > > > trying to use using script/console. You should also read this:http://api.rubyonrails.org/classes/ActionController/Routing.html > > > > > > R > > > > > > On Sep 26, 7:05 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > > > Any1?? > > > > > > > (Soz for bump, im just RLLY desperate to fix) > > > > > > > On Sep 25, 6:02 pm, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > > > > Then I get this error on the tutorial show page: > > > > > > > > edit_category_tutorial_url failed to generate from > > > > > > > {:action=>"edit", :controller=>"tutorials", :category_id=>#<Tutorial > > > > > > > id: 14, category_id: 1, name: "Thetutorialsname", content: "the > > > > > > >tutorialscontent", created_at: "2009-09-21 15:55:54", updated_at: > > > > > > > "2009-09-21 15:55:54">}, expected: > > > > > > > {:action=>"edit", :controller=>"tutorials"}, diff: > > > > > > > {:category_id=>#<Tutorial id: 14, category_id: 1, name: "The Tutorial > > > > > > > Name", content: "Thetutorialscontent", created_at: "2009-09-21 > > > > > > > 15:55:54", updated_at: "2009-09-21 15:55:54">} > > > > > > > > On Sep 25, 9:11 am, bill walton <bwalton...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > Hi Joe, > > > > > > > > > On Thu, 2009-09-24 at 22:54 -0700, Joe wrote: > > > > > > > > > edit_category GET /categories/:id/edit(.:format) > > > > > > > > > edit_category_tutorial GET /categories/:category_id/tutorials/:id/edit > > > > > > > > > (.:format) > > > > > > > > > > > On Sep 24, 11:09 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > > > > > > > > <%= link_to ''Edit'', edit_category_path(@category) %> > > > > > > > > > > > > but when I change this totutorials: > > > > > > > > > > > > <%= link_to ''Edit'', edit_tutorial_path(@tutorial) %> > > > > > > > > > > > > I get this error on the tutorial show page: > > > > > > > > > > > > undefined method `edit_tutorial_path'' for #<ActionView::Base: > > > > > > > > > > > 0x5ce52fc> > > > > > > > > > It looks like you just need to use the correct route which, it appears, > > > > > > > > is named: > > > > > > > > > edit_category_tutorial_path > > > > > > > > > HTH, > > > > > > > > Bill
If you''re not good in rails, why are you doing a website in it? Why are you posting here? Probably to get better, right? Or is it just to have us fix your site. The info I''m giving you is to help *you* solve your problem. It''s not my problem, and not the problem of this forum. People that post help here are here to help others that want to help themselves learn, not get the helpfulness of this forum to build or fix your app post by post. You''re turning help away when you skate past my links and references and such and just want a *direct* answer. It''s frustrating. If anyone gives you a direct answer, you''ll undoubtedly be back with another desperate request insisting on it being written out for you word-by-word. RTM. On Sep 28, 1:17 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote:> Im attempting to edit the tutorial and the tutorial does have content > and name, not the category. > > Are the other content bits messing up because i havnt done the form > correctly then? > > If so do you have a more direct response to fix it? as im really not > good in rails... > > Thanks In Advance, > > Joe > > On Sep 27, 10:49 pm, richardun <richar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I know you''ve moved on from the path issue, but to help you in the > > future, I found something that has helped me figure out paths. One, > > someone already mentioned, which was: > > > :; rake routes > > > Which you probably already knew. But you can also put a path in that > > you''re guessing will work and see what the actual URL it converts it > > to at runtime: > > > :; ruby script/console > > :; >> include ActionController::UrlWriter > > :; => Object > > :; >> sessions_path > > :; => "/sessions" > > > Also, there are lots of cool helpers / tricks you can use in Rails, > > like the *_path helper, but I''ve made the mistake of trying to make > > some of them work during a tight deadline or when there''s high > > pressure (site down). If this path or url_for thing is giving you > > issues, you can put in an old school :controller => > > ''mycontroller'', :action => ''myaction'' to resolve it. > > > If you''re getting undefined method errors in your form, it''s because > > the "f" is representing an object that doesn''t have methods for the > > field you''re trying to use. Go to this site: http://railsbrain.com/ > > View the doc for your rails version and look up: form_for I > > downloaded and use this site for my dev... it''s extremely helpful. > > > You''re not using form_for correctly. Here are the parameters it > > takes: > > > form_for(record_or_name_or_array, *args, &proc) > > > So, it''s using the first one, "@tutorial.category" for the main > > object. Do you have a "content" column in Category? Are you trying > > to edit Category or tutorial? The error you''re getting shows it''s > > using a Category object: > > > undefined method `category_id'' for #<Category:0x5fefc2c> > > > for #<Category:0x5fefc2c> indicates it''s using a Category object. > > Check out the API and use that when you''re not positive about the > > usage. It''s definitely worth the read, especially in very busy times. > > > Richard > > > On Sep 27, 1:53 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > Right.. Just maybe figured out another bit of it. I changed: > > > > <% form_for(@tutorial_category, @tutorial) do |f| %> > > > > to > > > > <% form_for(@tutorial.category, @tutorial) do |f| %> > > > > and this seems to function properly, however now I have a new issue > > > that ive been working on for hours and still cant figure out how to > > > fix. > > > In the form the category part of it is like this: > > > > <%= f.label :category_id %><br /> > > > <%= f.text_field :category_id %> > > > > The first label line works fine but I get this error for the next > > > line: > > > > undefined method `category_id'' for #<Category:0x5fefc2c> > > > > (or something like that) > > > > Ive tried every possible combination I can think of with changing > > > category_id all the way to things like tutorial.category_id and > > > allsorts. > > > > So this is the first error I cant solve, so i decided to try without > > > it and see if the other features work, well :name seems to work fine, > > > but the next bit (:content) dosn''t work. > > > > At the moment its like this: > > > > <%= f.label :content %><br /> > > > <%= f.text_area :content %> > > > > once again I get the error for the second of the two lines. > > > > And this is my second problem that I cant fix, I havnt tried > > > without :content and without :category_id yet so im not sure if the > > > update button works, but I tink these problems should be dealt with > > > first. > > > > Regards, > > > > and Thanks In Advance, > > > > Joe > > > > On Sep 26, 6:52 pm, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > Strangely.. I acctually figured out what was wrong and corrected to: > > > > edit_category_tutorial_path(@tutorial_category.id, @tutorial) > > > > > which seems to lead to the edit page. However I now have an issue on > > > > this page, as the form as it was ( <% form_for(@tutorial) do |f| %> ) > > > > gives the error: > > > > > undefined method `tutorial_path'' > > > > > So I decided logically to change it to: <% form_for > > > > (@tutorial_category.id, @tutorial) do |f| %> > > > > > which gave a fixnum error, which I read was because I used ".id" > > > > which is a fixed integer so i changed it to: > > > > > <% form_for(@tutorial_category, @tutorial) do |f| %> > > > > > which now gives me the error I cant solve: > > > > > undefined method `nil_class_path'' for #<ActionView::Base:0x60caf34> > > > > > (or something of those origins) > > > > > Please Help me solve this issue, and sorry for my permanent bumping > > > > and this time I shall wait until I decide to bump (if I decide to bump > > > > atall) > > > > > Thanks In Advance, > > > > > Joe > > > > > On Sep 26, 5:33 pm, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > > Yes correct I am desperate rather often as I was supposed to only take > > > > > my site down for a few says to do this and it hs extended onto weeks. > > > > > > I will read the link (although im so bas in RoR im not honestly sure > > > > > if i''ll understand it), > > > > > > If anyone wants to give a more direct answer please feel free to do > > > > > so, as the chances are I havnt been able to figure it out. > > > > > > Regards, > > > > > > Joe > > > > > > On Sep 26, 3:01 pm, richardun <richar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > Marnen is right. You''re not going to get far with people''s help most > > > > > > places if you don''t take the minimal effort to be courteous (or at > > > > > > least stop using "Soz"). > > > > > > > You seem to be desperate rather often (http://groups.google.com/group/ > > > > > > rubyonrails-talk/browse_thread/thread/ > > > > > > a25e07d2414e2b32/4bca7399878d02d7#4bca7399878d02d7) and feel the need > > > > > > to bump before 24 hours. > > > > > > > I will tell you, there is a way to evaluate / display the path you''re > > > > > > trying to use using script/console. You should also read this:http://api.rubyonrails.org/classes/ActionController/Routing.html > > > > > > > R > > > > > > > On Sep 26, 7:05 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > > > > Any1?? > > > > > > > > (Soz for bump, im just RLLY desperate to fix) > > > > > > > > On Sep 25, 6:02 pm, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > > > > > Then I get this error on the tutorial show page: > > > > > > > > > edit_category_tutorial_url failed to generate from > > > > > > > > {:action=>"edit", :controller=>"tutorials", :category_id=>#<Tutorial > > > > > > > > id: 14, category_id: 1, name: "Thetutorialsname", content: "the > > > > > > > >tutorialscontent", created_at: "2009-09-21 15:55:54", updated_at: > > > > > > > > "2009-09-21 15:55:54">}, expected: > > > > > > > > {:action=>"edit", :controller=>"tutorials"}, diff: > > > > > > > > {:category_id=>#<Tutorial id: 14, category_id: 1, name: "The Tutorial > > > > > > > > Name", content: "Thetutorialscontent", created_at: "2009-09-21 > > > > > > > > 15:55:54", updated_at: "2009-09-21 15:55:54">} > > > > > > > > > On Sep 25, 9:11 am, bill walton <bwalton...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > Hi Joe, > > > > > > > > > > On Thu, 2009-09-24 at 22:54 -0700, Joe wrote: > > > > > > > > > > edit_category GET /categories/:id/edit(.:format) > > > > > > > > > > edit_category_tutorial GET /categories/:category_id/tutorials/:id/edit > > > > > > > > > > (.:format) > > > > > > > > > > > > On Sep 24, 11:09 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > > > > > > > > > <%= link_to ''Edit'', edit_category_path(@category) %> > > > > > > > > > > > > > but when I change this totutorials: > > > > > > > > > > > > > <%= link_to ''Edit'', edit_tutorial_path(@tutorial) %> > > > > > > > > > > > > > I get this error on the tutorial show page: > > > > > > > > > > > > > undefined method `edit_tutorial_path'' for #<ActionView::Base: > > > > > > > > > > > > 0x5ce52fc> > > > > > > > > > > It looks like you just need to use the correct route which, it appears, > > > > > > > > > is named: > > > > > > > > > > edit_category_tutorial_path > > > > > > > > > > HTH, > > > > > > > > > Bill > >
Well of couse im learning from it, and that is for sure. But I really need to fix this before the big part of the learning curve. I do want a more direct answer as personally although direct answer may be classed as "cheating" or "making you do it for me" its the way I find it best to learn. I am still reading through the links you gave but really I cant make much sense of it, and im sorry if im a complete idiot, but its really not my fault. Im open to learning but personally I dont learn by reading pages of text cluttered with jargon that I dont understand. Regards, Please Help, Joe On Sep 28, 2:44 pm, richardun <richar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> If you''re not good in rails, why are you doing a website in it? Why > are you posting here? Probably to get better, right? Or is it just > to have us fix your site. The info I''m giving you is to help *you* > solve your problem. It''s not my problem, and not the problem of this > forum. People that post help here are here to help others that want > to help themselves learn, not get the helpfulness of this forum to > build or fix your app post by post. You''re turning help away when you > skate past my links and references and such and just want a *direct* > answer. > > It''s frustrating. If anyone gives you a direct answer, you''ll > undoubtedly be back with another desperate request insisting on it > being written out for you word-by-word. > > RTM. > > On Sep 28, 1:17 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > Im attempting to edit the tutorial and the tutorial does have content > > and name, not the category. > > > Are the other content bits messing up because i havnt done the form > > correctly then? > > > If so do you have a more direct response to fix it? as im really not > > good in rails... > > > Thanks In Advance, > > > Joe > > > On Sep 27, 10:49 pm, richardun <richar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I know you''ve moved on from the path issue, but to help you in the > > > future, I found something that has helped me figure out paths. One, > > > someone already mentioned, which was: > > > > :; rake routes > > > > Which you probably already knew. But you can also put a path in that > > > you''re guessing will work and see what the actual URL it converts it > > > to at runtime: > > > > :; ruby script/console > > > :; >> include ActionController::UrlWriter > > > :; => Object > > > :; >> sessions_path > > > :; => "/sessions" > > > > Also, there are lots of cool helpers / tricks you can use in Rails, > > > like the *_path helper, but I''ve made the mistake of trying to make > > > some of them work during a tight deadline or when there''s high > > > pressure (site down). If this path or url_for thing is giving you > > > issues, you can put in an old school :controller => > > > ''mycontroller'', :action => ''myaction'' to resolve it. > > > > If you''re getting undefined method errors in your form, it''s because > > > the "f" is representing an object that doesn''t have methods for the > > > field you''re trying to use. Go to this site: http://railsbrain.com/ > > > View the doc for your rails version and look up: form_for I > > > downloaded and use this site for my dev... it''s extremely helpful. > > > > You''re not using form_for correctly. Here are the parameters it > > > takes: > > > > form_for(record_or_name_or_array, *args, &proc) > > > > So, it''s using the first one, "@tutorial.category" for the main > > > object. Do you have a "content" column in Category? Are you trying > > > to edit Category or tutorial? The error you''re getting shows it''s > > > using a Category object: > > > > undefined method `category_id'' for #<Category:0x5fefc2c> > > > > for #<Category:0x5fefc2c> indicates it''s using a Category object. > > > Check out the API and use that when you''re not positive about the > > > usage. It''s definitely worth the read, especially in very busy times. > > > > Richard > > > > On Sep 27, 1:53 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > Right.. Just maybe figured out another bit of it. I changed: > > > > > <% form_for(@tutorial_category, @tutorial) do |f| %> > > > > > to > > > > > <% form_for(@tutorial.category, @tutorial) do |f| %> > > > > > and this seems to function properly, however now I have a new issue > > > > that ive been working on for hours and still cant figure out how to > > > > fix. > > > > In the form the category part of it is like this: > > > > > <%= f.label :category_id %><br /> > > > > <%= f.text_field :category_id %> > > > > > The first label line works fine but I get this error for the next > > > > line: > > > > > undefined method `category_id'' for #<Category:0x5fefc2c> > > > > > (or something like that) > > > > > Ive tried every possible combination I can think of with changing > > > > category_id all the way to things like tutorial.category_id and > > > > allsorts. > > > > > So this is the first error I cant solve, so i decided to try without > > > > it and see if the other features work, well :name seems to work fine, > > > > but the next bit (:content) dosn''t work. > > > > > At the moment its like this: > > > > > <%= f.label :content %><br /> > > > > <%= f.text_area :content %> > > > > > once again I get the error for the second of the two lines. > > > > > And this is my second problem that I cant fix, I havnt tried > > > > without :content and without :category_id yet so im not sure if the > > > > update button works, but I tink these problems should be dealt with > > > > first. > > > > > Regards, > > > > > and Thanks In Advance, > > > > > Joe > > > > > On Sep 26, 6:52 pm, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > > Strangely.. I acctually figured out what was wrong and corrected to: > > > > > edit_category_tutorial_path(@tutorial_category.id, @tutorial) > > > > > > which seems to lead to the edit page. However I now have an issue on > > > > > this page, as the form as it was ( <% form_for(@tutorial) do |f| %> ) > > > > > gives the error: > > > > > > undefined method `tutorial_path'' > > > > > > So I decided logically to change it to: <% form_for > > > > > (@tutorial_category.id, @tutorial) do |f| %> > > > > > > which gave a fixnum error, which I read was because I used ".id" > > > > > which is a fixed integer so i changed it to: > > > > > > <% form_for(@tutorial_category, @tutorial) do |f| %> > > > > > > which now gives me the error I cant solve: > > > > > > undefined method `nil_class_path'' for #<ActionView::Base:0x60caf34> > > > > > > (or something of those origins) > > > > > > Please Help me solve this issue, and sorry for my permanent bumping > > > > > and this time I shall wait until I decide to bump (if I decide to bump > > > > > atall) > > > > > > Thanks In Advance, > > > > > > Joe > > > > > > On Sep 26, 5:33 pm, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > > > Yes correct I am desperate rather often as I was supposed to only take > > > > > > my site down for a few says to do this and it hs extended onto weeks. > > > > > > > I will read the link (although im so bas in RoR im not honestly sure > > > > > > if i''ll understand it), > > > > > > > If anyone wants to give a more direct answer please feel free to do > > > > > > so, as the chances are I havnt been able to figure it out. > > > > > > > Regards, > > > > > > > Joe > > > > > > > On Sep 26, 3:01 pm, richardun <richar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > Marnen is right. You''re not going to get far with people''s help most > > > > > > > places if you don''t take the minimal effort to be courteous (or at > > > > > > > least stop using "Soz"). > > > > > > > > You seem to be desperate rather often (http://groups.google.com/group/ > > > > > > > rubyonrails-talk/browse_thread/thread/ > > > > > > > a25e07d2414e2b32/4bca7399878d02d7#4bca7399878d02d7) and feel the need > > > > > > > to bump before 24 hours. > > > > > > > > I will tell you, there is a way to evaluate / display the path you''re > > > > > > > trying to use using script/console. You should also read this:http://api.rubyonrails.org/classes/ActionController/Routing.html > > > > > > > > R > > > > > > > > On Sep 26, 7:05 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > > > > > Any1?? > > > > > > > > > (Soz for bump, im just RLLY desperate to fix) > > > > > > > > > On Sep 25, 6:02 pm, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > > > > > > Then I get this error on the tutorial show page: > > > > > > > > > > edit_category_tutorial_url failed to generate from > > > > > > > > > {:action=>"edit", :controller=>"tutorials", :category_id=>#<Tutorial > > > > > > > > > id: 14, category_id: 1, name: "Thetutorialsname", content: "the > > > > > > > > >tutorialscontent", created_at: "2009-09-21 15:55:54", updated_at: > > > > > > > > > "2009-09-21 15:55:54">}, expected: > > > > > > > > > {:action=>"edit", :controller=>"tutorials"}, diff: > > > > > > > > > {:category_id=>#<Tutorial id: 14, category_id: 1, name: "The Tutorial > > > > > > > > > Name", content: "Thetutorialscontent", created_at: "2009-09-21 > > > > > > > > > 15:55:54", updated_at: "2009-09-21 15:55:54">} > > > > > > > > > > On Sep 25, 9:11 am, bill walton <bwalton...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > Hi Joe, > > > > > > > > > > > On Thu, 2009-09-24 at 22:54 -0700, Joe wrote: > > > > > > > > > > > edit_category GET /categories/:id/edit(.:format) > > > > > > > > > > > edit_category_tutorial GET /categories/:category_id/tutorials/:id/edit > > > > > > > > > > > (.:format) > > > > > > > > > > > > > On Sep 24, 11:09 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > > > > > > > > > > > <%= link_to ''Edit'', edit_category_path(@category) %> > > > > > > > > > > > > > > but when I change this totutorials: > > > > > > > > > > > > > > <%= link_to ''Edit'', edit_tutorial_path(@tutorial) %> > > > > > > > > > > > > > > I get this error on the tutorial show page: > > > > > > > > > > > > > > undefined method `edit_tutorial_path'' for #<ActionView::Base: > > > > > > > > > > > > > 0x5ce52fc> > > > > > > > > > > > It looks like you just need to use the correct route which, it appears, > > > > > > > > > > is named: > > > > > > > > > > > edit_category_tutorial_path > > > > > > > > > > > HTH, > > > > > > > > > > Bill
Joe wrote:> Well of couse im learning from it, and that is for sure. But I really > need to fix this before the big part of the learning curve.You''re expecting the impossible. If you want to fix this app yourself, you need to learn enough to fix it. If you don''t have time to do that, then you''ll have to hire someone to fix the app, and perhaps teach you some stuff along the way.> I do want > a more direct answer as personally although direct answer may be > classed as "cheating" or "making you do it for me" its the way I find > it best to learn.Well, it''s not the way most people on this list find it best to teach.> > I am still reading through the links you gave but really I cant make > much sense of it,Perhaps if you asked about the parts you don''t understand we could help you. In any case, have you established the basics? Have you read Programming Ruby? Have you read the Rails Guides ( http://guides.rails.info )? If not, then do so.> and im sorry if im a complete idiot, but its really > not my fault.Um, WTF? It''s your responsibility to make use of the materials available to you to learn what you need to know. If you need additional reference materials, please ask. If you fail to use the materials given you, however, that most certainly *is* your fault.> Im open to learning but personally I dont learn by > reading pages of text cluttered with jargon that I dont understand.Then learn the jargon first -- Programming Ruby is kind of a prerequisite. Again, if you don''t understand, please ask -- but only after a serious attempt to figure things out. Good luck! Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org> > > > Regards, > > Please Help, > > > Joe-- Posted via http://www.ruby-forum.com/.
> > I do want > > a more direct answer as personally although direct answer may be > > classed as "cheating" or "making you do it for me" its the way I find > > it best to learn. > > Well, it''s not the way most people on this list find it best to teach.Hmm... OK. This thing is with the post above. I dont want to learn massive ammounts of ruby on rails, I just basically want to make my site in it (although as you said this is a very difficult task if you dont know much RoR) but I had someone to help me through the first half and I ended up learning a whole lot, I never even knew how to create a rails app before, and now I know a basic ammount, and I know sort off how my whole system works. I fixed most of the errors etc, while my friend would just do the main parts for me. Then the problem arrised just at the last moment before we had incorporated the edit or destroy functions. I managed to create the destroy function as it was very similar to the category destroy function, but the edit seems much more difficult to fix. I will spend some more time looking through articles about this, and will look through some basics too. If anyone has any suggestions or tips to help me through this then please post, Thanks In Advance, Joe On Sep 28, 3:59 pm, Marnen Laibow-Koser <rails-mailing-l...@andreas- s.net> wrote:> Joe wrote: > > Well of couse im learning from it, and that is for sure. But I really > > need to fix this before the big part of the learning curve. > > You''re expecting the impossible. If you want to fix this app yourself, > you need to learn enough to fix it. If you don''t have time to do that, > then you''ll have to hire someone to fix the app, and perhaps teach you > some stuff along the way. > > > I do want > > a more direct answer as personally although direct answer may be > > classed as "cheating" or "making you do it for me" its the way I find > > it best to learn. > > Well, it''s not the way most people on this list find it best to teach. > > > > > I am still reading through the links you gave but really I cant make > > much sense of it, > > Perhaps if you asked about the parts you don''t understand we could help > you. > > In any case, have you established the basics? Have you read Programming > Ruby? Have you read the Rails Guides (http://guides.rails.info)? If > not, then do so. > > > and im sorry if im a complete idiot, but its really > > not my fault. > > Um, WTF? It''s your responsibility to make use of the materials > available to you to learn what you need to know. If you need additional > reference materials, please ask. If you fail to use the materials given > you, however, that most certainly *is* your fault. > > > Im open to learning but personally I dont learn by > > reading pages of text cluttered with jargon that I dont understand. > > Then learn the jargon first -- Programming Ruby is kind of a > prerequisite. Again, if you don''t understand, please ask -- but only > after a serious attempt to figure things out. Good luck! > > Best, > -- > Marnen Laibow-Koserhttp://www.marnen.org > mar...-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > > > > > Regards, > > > Please Help, > > > Joe > > -- > Posted viahttp://www.ruby-forum.com/.
2009/9/28 Joe <joe-T/oTI28FLjDQXOPxS62xeg@public.gmane.org>:> >> > I do want >> > a more direct answer as personally although direct answer may be >> > classed as "cheating" or "making you do it for me" its the way I find >> > it best to learn. >> >> Well, it''s not the way most people on this list find it best to teach. > > > Hmm... OK. > > This thing is with the post above. I dont want to learn massive > ammounts of ruby on rails, I just basically want to make my site in it > (although as you said this is a very difficult task if you dont know > much RoR) but I had someone to help me through the first half and I > ended up learning a whole lot, I never even knew how to create a rails > app before, and now I know a basic ammount, and I know sort off how my > whole system works. I fixed most of the errors etc, while my friend > would just do the main parts for me. Then the problem arrised just at > the last moment before we had incorporated the edit or destroy > functions. I managed to create the destroy function as it was very > similar to the category destroy function, but the edit seems much more > difficult to fix. > > I will spend some more time looking through articles about this, and > will look through some basics too. > > If anyone has any suggestions or tips to help me through this then > please post,You say ''my site''. Can you give us some more background into what the site is for. Is it a commercial endeavour? Colin
Have a look for yourself http://www.dev-hq.co.uk Its at the moment what would be classed as a "hobby site" but I plan to grow it into a profitable buissness in time. Once again please help, Thanks In Advance, Joe On Sep 28, 6:42 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> 2009/9/28 Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org>: > > > > > > >> > I do want > >> > a more direct answer as personally although direct answer may be > >> > classed as "cheating" or "making you do it for me" its the way I find > >> > it best to learn. > > >> Well, it''s not the way most people on this list find it best to teach. > > > Hmm... OK. > > > This thing is with the post above. I dont want to learn massive > > ammounts of ruby on rails, I just basically want to make my site in it > > (although as you said this is a very difficult task if you dont know > > much RoR) but I had someone to help me through the first half and I > > ended up learning a whole lot, I never even knew how to create a rails > > app before, and now I know a basic ammount, and I know sort off how my > > whole system works. I fixed most of the errors etc, while my friend > > would just do the main parts for me. Then the problem arrised just at > > the last moment before we had incorporated the edit or destroy > > functions. I managed to create the destroy function as it was very > > similar to the category destroy function, but the edit seems much more > > difficult to fix. > > > I will spend some more time looking through articles about this, and > > will look through some basics too. > > > If anyone has any suggestions or tips to help me through this then > > please post, > > You say ''my site''. Can you give us some more background into what the > site is for. Is it a commercial endeavour? > > Colin
2009/9/28 Joe <joe-T/oTI28FLjDQXOPxS62xeg@public.gmane.org>:> > Have a look for yourself http://www.dev-hq.co.uk > > Its at the moment what would be classed as a "hobby site" but I plan > to grow it into a profitable buissness in time. >Well there is the problem, or at least part of it. If you had been struggling to complete a site for a worthy non-profit making organisation then it would be valid to throw yourself on the mercy of the list and hope that someone might spend their time walking you through your problems. As this is not the case, however, then all you should hope for is pointers as to where you are going wrong and where to go to educate yourself so that you can work out the detail of the solution yourself. Colin
Hmm. ok, I suppose you have a vailid point. I will look through many articles and post back if I find a solution (for anyone else who encounters this problem) On Sep 28, 8:52 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> 2009/9/28 Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org>: > > > > > Have a look for yourself http://www.dev-hq.co.uk > > > Its at the moment what would be classed as a "hobby site" but I plan > > to grow it into a profitable buissness in time. > > Well there is the problem, or at least part of it. If you had been > struggling to complete a site for a worthy non-profit making > organisation then it would be valid to throw yourself on the mercy of > the list and hope that someone might spend their time walking you > through your problems. As this is not the case, however, then all you > should hope for is pointers as to where you are going wrong and where > to go to educate yourself so that you can work out the detail of the > solution yourself. > > Colin
I had to write a new path in routes.rb, it waas that simple. Fixed it all by myself and I feel good that I did it on my own! Thanks anyway guys, Joe On Sep 29, 6:12 pm, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote:> Hmm. ok, I suppose you have a vailid point. > > I will look through many articles and post back if I find a solution > (for anyone else who encounters this problem) > > On Sep 28, 8:52 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > 2009/9/28 Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org>: > > > > Have a look for yourself http://www.dev-hq.co.uk > > > > Its at the moment what would be classed as a "hobby site" but I plan > > > to grow it into a profitable buissness in time. > > > Well there is the problem, or at least part of it. If you had been > > struggling to complete a site for a worthy non-profit making > > organisation then it would be valid to throw yourself on the mercy of > > the list and hope that someone might spend their time walking you > > through your problems. As this is not the case, however, then all you > > should hope for is pointers as to where you are going wrong and where > > to go to educate yourself so that you can work out the detail of the > > solution yourself. > > > Colin