Class Nil when posting #69
Replies: 1 comment
-
Google Group Date: Wed, 11 Jan 2017 23:16:52 -0800 Hi Jeremy, This small issue, drilled me to go through your documentation completely. I am so inspired by your SPAM demo accounts entry. I would like to apply We can have button to delete an entry in the subform. Please let me know, if I am anywhere wrong. Thank you once again, for your continuous support. Best regards, I.Murugesan On Wednesday, January 11, 2017 at 11:55:33 PM UTC+5:30, Jeremy Evans wrote:
|
Beta Was this translation helpful? Give feedback.
-
Google Group Post: https://groups.google.com/g/ruby-forme/c/YVcQ2AA3pcs
Google Group Date: Wed, 11 Jan 2017 07:52:09 -0800
Google Group Sender: [email protected]
Hi Jeremy,
Thanks for your reply.
While submitting still r['album'] returns nil. But r.params returned the
following:
{"forme_demo/album"=>{"name"=>"Ethnicity", "release_date"=>"2013/03/01",
"copies_sold"=>"31000", "debut_album"=>"f", "out_of_print"=>"t",
"artist_attributes"=>{"name"=>"Yanni"},
"tracks_attributes"=>{"0"=>{"number"=>"1", "name"=>"Rite of Passage",
"length"=>"19"}, "1"=>{"number"=>"2", "name"=>"For All Seasons",
"length"=>"28"}, "2"=>{"number"=>"3", "name"=>"The Promise",
"length"=>"21"}}}}
r.post 'album' do
logger.info p r.params
logger.info p r['album']
r.redirect r.referrer
end
I have not edited much in others, but posted for your reference.
r.is 'grid' do
@page_title = 'Single Level Grid'
@subform_opts = {:grid=>true}
@Album = Album.new
demo :album_nested
end
album_nested.erb
<% form(@Album, form_attr, form_opts) do |f| %>
<% f.inputs([:name, :release_date, :copies_sold, :debut_album,
:out_of_print], :legend=>:Album) do %>
<%@album.associations[:artist] = Artist.new%>
<%@album.associations[:tracks] = [Track.new, Track.new, Track.new]%>
<%= f.subform(:artist, {:inputs=>[:name]}.merge(subform_opts)) %>
<% f.subform(:tracks, {:inputs=>[:number, :name,
:length]}.merge(subform_opts)) do %>
<%= f.tag(:td, {}, ['Delete'])%>
<%end%>
<% end %>
<%= f.button(:value=>'Submit') %>
<% end %>
Please let me know, if you still need more information.
Thanks.
I.Murugesan
Beta Was this translation helpful? Give feedback.
All reactions