Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>thank you for your help so far here is my full form :</p> <pre><code> &lt;p&gt; &lt;h1&gt;Create message&lt;/h1&gt; &lt;/p&gt; &lt;% form_for @machine_enquiry, machine_enquiry_path(@machine_enquiry) do|me_form| %&gt; &lt;div class="form_full_holder span-18 last"&gt; &lt;%= me_form.error_messages %&gt; &lt;/div&gt; &lt;% me_form.fields_for :messages_attributes do |f| %&gt; &lt;%= f.hidden_field :in, :value=&gt;1 unless is_admin%&gt; &lt;div class="form_full_holder span-18 last"&gt; &lt;div class="form_full_label span-5"&gt; Title &lt;%= "| type | reminder" if is_admin %&gt; &lt;/div&gt; &lt;div class="form_full_label span-13 last"&gt; &lt;%= f.text_field :title -%&gt; &lt;%= f.collection_select(:message_type_id, MessageType.all, :id, :thetype, {}, {:class=&gt;"select_normal"}) if is_admin -%&gt; &lt;% if is_admin %&gt; &lt;input type="text" name="datetime" id="datetime" value="" class="btn_normal"&gt; &lt;% end %&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="form_full_holder span-18 last"&gt; &lt;div class="infiniteCarousel"&gt; &lt;div class="wrapper"&gt; &lt;ul&gt; &lt;% @contact_details.each do |contact| %&gt; &lt;li&gt; &lt;%= radio_button_tag "machine_enquiry[messages_attributes[contact_detail_ids][]", contact.id, false, :class=&gt;"checkbox_normal" %&gt; &lt;%= " Contact : " + contact.name %&gt; &lt;%= "&lt;br&gt;Email : " + contact.email %&gt; &lt;/li&gt; &lt;% end %&gt; &lt;/ul&gt; &lt;/div&gt; &lt;a class="arrow back"&gt;&lt;/a&gt; &lt;a class="arrow forward"&gt;&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="form_full_holder span-18 last"&gt; &lt;%= f.text_area :message %&gt; &lt;/div&gt; &lt;div class="form_full_holder span-18 last"&gt; &lt;div class="infiniteCarousel"&gt; &lt;div class="wrapper"&gt; &lt;ul&gt; &lt;% @companies.each do |company| %&gt; &lt;% company.contact_details.each do |contact| %&gt; &lt;li&gt; &lt;%= check_box_tag "machine_enquiry[messages_attributes[contact_detail_ids][]", contact.id, false, :class=&gt;"checkbox_normal" %&gt; &lt;% if is_admin %&gt; &lt;%= " Buyer : " + company.name %&gt; &lt;% else %&gt; &lt;%= "Seller : " + company.name %&gt; &lt;% end %&gt; &lt;%= "&lt;br&gt;Contact : " + contact.name %&gt; &lt;%= "&lt;br&gt;Phone : " + contact.phone %&gt; &lt;%= "&lt;br&gt;Email : " + contact.email %&gt; &lt;/li&gt; &lt;% end %&gt; &lt;% end %&gt; &lt;% if is_admin %&gt; &lt;% @suppliers.each do |company| %&gt; &lt;% company.contact_details.each do |contact| %&gt; &lt;li&gt; &lt;%= check_box_tag "machine_enquiry[messages_attributes[contact_detail_ids][]", contact.id, false, :class=&gt;"checkbox_normal" %&gt; &lt;%= " Supplier : " + company.name %&gt; &lt;%= "&lt;br&gt;Contact : " + contact.name %&gt; &lt;%= "&lt;br&gt;Phone : " + contact.phone %&gt; &lt;%= "&lt;br&gt;Email : " + contact.email %&gt; &lt;/li&gt; &lt;% end %&gt; &lt;% end %&gt; &lt;% end %&gt; &lt;/ul&gt; &lt;/div&gt; &lt;a class="arrow back"&gt;&lt;/a&gt; &lt;a class="arrow forward"&gt;&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;% end %&gt; &lt;div class="form_full_holder span-18 last"&gt; &lt;div class="form_full_label span-5"&gt; &amp;nbsp; &lt;/div&gt; &lt;div class="form_full_label span-13 last"&gt; &lt;%= me_form.submit 'Send message' %&gt; &lt;/div&gt; &lt;/div&gt; &lt;% end %&gt; </code></pre> <p>and here is the message model. Message as you didnt know about is also an attribute in message model.</p> <pre><code>class Message &lt; ActiveRecord::Base belongs_to :user belongs_to :enquiry belongs_to :messagable, :polymorphic =&gt; true has_many :distributes, :dependent =&gt; :destroy has_many :contact_details, :through=&gt;:distributes validates_presence_of :title validates_presence_of :message end </code></pre> <p>hope you can solve this problem for me.</p> <p>thank you rick</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload