i know that it is newbie question but i dont know the answer(
i need to set in my form params[:message][:reciever_id] how todo it?
my user model have
has_many :sent_messages, :class_name => "Message", :foreign_key => "sender_id"
has_many :received_messages, :class_name => "Message", :foreign_key => "receiver_id"
i was doing in my message form
= f.hidden_field :receiver_id,:value => @user
= f.hidden_field :sender_id, :value => current_user
but it doesnt work. So how to do it?
Thanks in advance
Maybe:
But that’s not the way to do it, prefill the value in your controller (action new):
And in the create action: