[Rails] Re: baffled with form_for

2009-04-21 Thread Wang Pengcheng
Most time, you can put a reference manual in your desk. When you can't confirm the settings , you can find it very quickly. For example : Rails: Up and Running, Second Edition Appendix B http://cachefly.oreilly.com/oreilly/pdfs/9780596522001_appendixB.pdf On Apr 21, 10:55 pm, Harm wrote: > Tha

[Rails] Re: baffled with form_for

2009-04-21 Thread Harm
Thank you Dmitry. I'll ponder a bit on your remark, my initial gut feeling is that I do want a singleton resource as I never want to expose more than 1 user. Ever. Which is restful. But I'll think about it. On Apr 21, 4:45 pm, Dmitry Sokurenko wrote: > Just make users a collection (map.resources

[Rails] Re: baffled with form_for

2009-04-21 Thread Dmitry Sokurenko
Just make users a collection (map.resources :users), then everything will work fine. Or if your really want it to be a singleton (bad idea, not restfull if you have more than 1 user in your app), then use form_for :user, :object => @user. Dmitry --~--~-~--~~~---~--~---

[Rails] Re: baffled with form_for

2009-04-21 Thread Harm
Ow I did misspelled it. I didn't do so in my code. On Apr 21, 4:10 pm, Marnen Laibow-Koser wrote: > Harm wrote: > > That was my initial hunch as well. And it is an AR object. > > > I believe that the fact that the user is a singleton resource matters. > > E.g. > >     map.resouce :user, :control

[Rails] Re: baffled with form_for

2009-04-21 Thread Marnen Laibow-Koser
Harm wrote: > That was my initial hunch as well. And it is an AR object. > > I believe that the fact that the user is a singleton resource matters. > E.g. > map.resouce :user, :controller => "Users" [...] You misspelled "resource" here. Is it also misspelled in your actual code? If so, th

[Rails] Re: baffled with form_for

2009-04-21 Thread Harm
That was my initial hunch as well. And it is an AR object. I believe that the fact that the user is a singleton resource matters. E.g. map.resouce :user, :controller => "Users" I modified the form_for and passed an explicit path with :url => user_path. This seems to work. But it is vert stra

[Rails] Re: baffled with form_for

2009-04-21 Thread Frederick Cheung
On 20 Apr 2009, at 20:11, harm wrote: > > I have a simple User form with a simple Usercontroller. > The 'edit' action looks like: > def edit >@user = current_user > end > > In the view: > <% form_for(@user) do |f| %> > blah blah > <% end %> > > What it generates is: > id="edit_user_196"