search for: accepts_nested_attributes

Displaying 8 results from an estimated 8 matches for "accepts_nested_attributes".

2010 Apr 10
1
accepts_nested_attributes + polymorphic association
im having an issue where my my polymorphic associations arent being deleted when using accepts nested attributes there are other accepts_nested_attributes being used and they are deleting fine, just the polymorphic association before i go down the path of intense thrashing at this...is this a known issue or problem? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on...
2013 Mar 04
0
fields_for with accepts_nested_attributes: how to pass a value to a label
...er < AC ... def new @timesheet = current_user.timesheets.new now = Date.today #generating 7 time entries: monday through sunday (now.beginning_of_week..now.end_of_week).step { |date| @timesheet.time_entries.build(:workdate; date) end end ... In the Timesheet model I defined accepts_nested_attributes for time_entries association: class Timesheet < AR has_many :time_entries, :dependent: :destroy accepts_nested_attributes_for :time_entries, reject_if: proc { |attr| attr[''worktime].blank? } end in the Timesheet ''new'' page: <%= form_for @timesheet do |f|%&g...
2013 Mar 04
2
accepts_nested_attributes: undefined method 'association'_attributes
I have 2 models Timesheet and TimeEntry: class Timesheet < ActiveRecord::Base attr_accessible :status, :user_id, :time_entries_attributes has_many :time_entries, dependent: :destroy accepts_nested_attributes_for :time_entries, :reject_if => proc { |attributes| attributes[''worktime''].blank? } end class TimeEntry < ActiveRecord::Base attr_accessible :task_id, :timesheet_id, :workdate, :worktime belongs_to :timesheet end As explained in Rails API: ``` Using with attr_ac...
2013 Mar 25
1
validates presence of foreign key fails in nested form
I''m using accepts_nested_attributes as follows: class Timesheet < ActiveRecord::Base attr_accessible :status, :user_id, :start_date, :end_date, :activities_attributes has_many :activities, dependent: :destroy has_many :time_entries, through: :activities accepts_nested_attributes_for :activities, allow_destroy: true end...
2010 Oct 14
2
Nested form, perhaps?
...the team. In each chosen person''s form row, she also needs to pick a role for that person from a select or radio field. So my question is this: Which model needs to draw this interface? I am thinking this is coming from the Project, which is iterating over a list of Person.all and accepts_nested_attributes for Roles within each instance of that list. Any other ideas about this? Thanks in advance, Walter -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+...
2012 Sep 29
0
rails 3.2 nested form names not correct
I have a person has many questions model, I have accepts_nested_Attributes set up properly. the question from the db show up, but the index is not incrementing: <%= f.fields_for :person_questions do |pregunta| %> Questions: <br/> <% Question.all.each do |question| %> <%= render ''questions/question_type'...
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 irb(main):001:0> post=Post.first => #<Post id: 1, name: "prova", title: "titolo prova", content: "prova 1", created_at: "20...
2010 Jan 26
2
accepts_nested_attributes_for :has_many :through => 'bug?'
Hey guys & ladies! I''ve got the following relationship which i''m trying to get accepts_nested_attributes to work with. But when i submit my form, it looks as if its expecting a Company object, rather than an array of companies. which really doesn''t make sense considering its a has_many :relationship. So what i''m after, is a way to accept_nested_attributes_for :companies, so when my...