Without the hidden field, your new result won't associate with the user, but it should at least render.
Is it blank or did you get an error? If it's an error, please post the error. If it's blank, try using the debugger to see if a result is built: <% require 'ruby-debug'; debugger %> Then, when it breaks, type "irb" and "this.results.build" and see what you get back. If it builds fine, check your permissions. build is documented here http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html Bryan bcavileer wrote: > I tried it and the form did not render.. here is the code I am > trying. > > <form with="&this.results.build"> > <error-messages/> > <field-list fields="steps"/> > <div> > <submit label="Save" /><or-cancel/> > </div> > </form> > > I was trying "&this.results.new" earlier and the same thing happens > the form does not render. > Also, do you know where I can find documentation on the 'build' method > you are using? > > On Jul 6, 4:59 pm, Bryan Larsen <[email protected]> wrote: >> rough outline: >> >> <form with="&this.results.build"> >> <input type="hidden" name="#{param_name_for_this}[user_id]" >> value="&this.user_id"> >> <field-list .../> >> </form> >> >> bcavileer wrote: >>> I'm having a difficult time modifying a form to function the way I'd >>> like it to operate. >>> My application has two models: User, Result >>> Users have_many Results >>> Results belong_to User >>> The intended goal is to put a form on the User's Show page that will >>> create a new Result for that user. >>> I've added a <form> to my User's Show page with a <field-list >>> fields="results"> >>> This hobomagically creates a input-many form and it works ok; however, >>> I have no desire to remove old results or edit them. This is too >>> much functionality. >>> I'd just like to add a form on the page that is not an input-many >>> form, but instead creates a single new Result . >>> It would ideally look like " Result : [ ] [submit]" >>> This form would simply POST a new Result with user_id = this user. >>> I know this should be easy but I haven't been able to get it >>> working... >>> I've tried for= and with= tags and all sorts of stuff.. I'm stuck. >>> Help is very much appreciated! > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Hobo Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/hobousers?hl=en -~----------~----~----~----~------~----~------~--~---
