ruby on rails - writing an attribute to my through table with validation? -


I am trying to do this from age and can understand it. Hope someone can help you?

I have a 'message' model, in which there are many through the 'distributed' relationship with the 'contact-details' model.

Originally many contacts may be connected with a message, this can be a message of multiple contacts.

I can get this to work and save it successfully, but I also have the Creator feature on the 'Distribuate' model, which I want to set to the right for the creator

{"message" => {"message" => "a great message ...", "messaging_id" =

"", "title" => "How are you?" = "" Machine_quality "," message_type_id "=>" 1 "," contact_detail_ids "=> [" 2 "," 2 "," 11 ',' 7 ']}, "committ" => "message Send "," datetime "=>" "}

In a 'distribution' model, a contact_detai L_id 'attribute and all these are savings but before saving I want to set up to create attribute with a contact_detail_id

I can do this after saving but I have to make sure that the manufacturer set Has been done, so why do I have to do this before saving? And not to make sure how to do it.

Any thoughts? Hopefully someone can help you?

Thanks in advance Rick

< Div class = "post-text" itemprop = "text">

The way you describe things, the manufacturer must be the same for every distribution record associated with a particular message. Understand more about saving the message from adding a new column and related_.

  class messages & lt; ActiveRecord :: Base is_to: Manufacturer ,: class_name = & gt; "User" creates a link for their user model validates_presence_of: creator_id # ensures that creator_id is not empty ... end  

to add that field as easy as adding to the form

<% = f.hidden_field: creator_id, current_user.id%>

If I believe it is wrong to believe that distribution record for the same message, then you should give details of the models related to a form.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -