> On Aug 14, 2018, at 5:49 PM, John Sanderbeck <bandor...@gmail.com> wrote: > > Not sure if the subject is correct for what I am trying to do... > > I am working on a School application and I added an Attendance section > > There is an attendance record that is associated to a student record > > The student record has an associated model called notes... > > What I would like to be able to do is add notes to the student through the > attendance record... > > My Attendance record belongs_to :student > My Student record has_many :attendances > My Student record has_many :notes > > I can access Attendance.student.notes just fine, but when I try to add notes > through a nested form it doesn't like that... > > Also just tried adding has_many :notes, through: :student and now I can > access Attendance.notes, however when I add > > <%= f.fields_for :notes %>
You need to add a 'do' at the end of the previous line. Without that, and... > <%= f.link_to_add "Add Note", :notes, class: 'btn btn-xs btn-primary > btn-padded' %> an end here to close the block, you're not giving a black to the fields_for macro. That's what the error means. Walter > > I get an error no block given(yield) > > Any suggestions on how to code the nested form? Is this a routes issue? > > John > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscr...@googlegroups.com. > To post to this group, send email to rubyonrails-talk@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/rubyonrails-talk/038295ce-0ea0-433a-8df0-7e29e681d934%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/BA6D1B66-D0F3-4B4C-A4B3-AE9425A52378%40wdstudio.com. For more options, visit https://groups.google.com/d/optout.