drewB wrote: [...]> Code: > > class Objective < ActiveRecord::Base > belongs_to :user > has_many :next_actions, :order => 'id DESC', :conditions => > {:completed => false} > has_many :action_items, :order => 'position' > has_many :progress_updates > > serialize :freq_value > > > validates_presence_of :name, :due_date, :completion, :pr_u_frequency_id > validates_numericality_of :completion, :only_integer => > true, :greater_than_or_equal_to => 0, :less_than_or_equal_to => 100 > > def self.create(attributes, user_id) > #create new record with user_id correctly set > attributes.delete :freq_options #deletes this unused key > obj = self.new(attributes) > obj.user_id = user_id > obj.save ? obj : nil > > end >
I don't know if this is directly related to your problem, but why are you overriding AR::Base.create ? You shouldn't need to; just do @user.objectives.create(attributes). You're trying to reinvent what AR already gives you for free. > end > [...] Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---