Displaying 3 results from an estimated 3 matches for "nestedattributes".
Did you mean:
nested_attributes
2011 Feb 11
1
accept_nested_attributes, reject_if doesn't work.
class Post < ActiveRecord::Base
validates :name, :presence => true
validates :title, :presence => true,
:length => { :minimum => 5 }
has_many :comments, :dependent => :destroy
has_many :tags
accepts_nested_attributes_for :tags, :allow_destroy => :true,
:reject_if => proc { |attrs| attrs.all? { |k, v| v.blank? or v.nil? } }
end
rails c
2013 Nov 10
3
accepts_nested_attributes_for how, example
...combo box for selecting category(like:
"Pictures", "Movies", etc), text box for title and text-area for content.
I followed many tutorials and documentation like:
http://railscasts.com/episodes/196-nested-model-form-part-1 and
http://api.rubyonrails.org/classes/ActiveRecord/NestedAttributes/ClassMethods.html#method-i-accepts_nested_attributes_for
but can''t get it how to work.
--
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 ru...
2011 Jul 16
0
nested_form gem don't work for accepts_nested_attributes_for :limit
...t;Remove this image" %>
<% end %>
<%= f.link_to_add "Add a Image", :images %>
<%= f.submit %>
<% end %>
The problem is when I add more images that the limit. Although I
delete it before submit the form, the post don''t validate:
ActiveRecord::NestedAttributes::TooManyRecords. For example, if I may
have 2 limit image and I do: - Add Image - Add Image - Add Image -
Delete Image - Delete Image - Browse Image File - SUBMIT FORM
Well, I would get the error. It''s a bug? Any help? Thanks
--
You received this message because you are subscribed to th...