ruby on rails - Help with Formtastic -


first of i'm no native speaker , begun rails 3 days ago. sorry mistakes. formtastic driving me crazy. have 3 tables: user, note, receiver:

class user < activerecord::base has_many :receivers has_many :notes, :through => :receivers attr_accessible :id, :email, :password, :password_confirmation, :remember_me  class note < activerecord::base has_many :receivers has_many :users, :through => :receivers attr_accessible :id, :text, :user_id accepts_nested_attributes_for :receivers  class receiver < activerecord::base belongs_to :user belongs_to :note attr_accessible :user_id, :note_id, :note_attributes  accepts_nested_attributes_for :user accepts_nested_attributes_for :note 

and here formtastic form:

<%= semantic_form_for @note |form| %> <%= form.inputs %>   <%= form.input :text %>   <%= form.input :user_id, :as => :check_boxes, :collection => user.find(:all, :conditions => ["id != ?", current_user.id], :order => 'id').collect{|u| [u.email, u.id]} %> <% end %> <%= form.buttons %> <% end %> 

now want create new note can have several receivers. unfortunately note created, no entrys in receiver table, if select receivers. can me please?

here notes_controller:

@note = note.new(params[:note]) 

print out params[:note] using logger.info , check parameters passed form , can try adding code reciever_ids code attr_accessible in note model


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -