Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There is a few problems with your code.</p> <p>I think the main problem is that you want your form to give employee_registers based on a search, but you don't have a javascript response from the search action. </p> <p>Lets say you have a search action like this</p> <pre><code>def search @employee_registers = Employee.where(:name =&gt; params[:search]) end </code></pre> <p>then in your search.js.erb file </p> <pre><code>$("#employee_registers").append("&lt;%= j(render @employee_registers) %&gt; </code></pre> <p>(the j() is an alias for escape_javascript() )</p> <p>In your _employee_registers.html.erb partial</p> <pre><code>&lt;div class="span2 curve"&gt; &lt;div class="profile_img"&gt; &lt;%= image_tag employee_register.image.url,:size =&gt; "150x180"%&gt; &lt;/div&gt; &lt;p&gt;&lt;strong&gt;&lt;%= employee_register.first_name %&gt;&lt;%= employee_register.last_name %&gt; &lt;br&gt; &lt;%= employee_register.department.name%&gt;&lt;%=employee_register.division.name%&gt;&lt;br&gt; &lt;%=mail_to employee_register.wemail%&gt;&lt;br&gt;&lt;/strong&gt;&lt;/p&gt; &lt;br/&gt;&lt;/br/&gt; &lt;/div&gt; &lt;br /&gt; </code></pre> <p>Now you have to change some code in the index.html.erb file</p> <pre><code>&lt;%= link_to 'New Employee register', new_employee_register_path %&gt; &lt;%= form_tag employee_registers_path, , :remote =&gt; true, :method =&gt; 'get', :id =&gt; "employee_registers_search" do %&gt; &lt;p&gt; &lt;%= select_tag "fieldtype", options_for_select([ "name", "email" ], "name") %&gt; &lt;%= text_field_tag :search, params[:search] %&gt; &lt;%= submit_tag "Search", :name =&gt; nil%&gt; &lt;/p&gt; &lt;div id="employee_registers"&gt;&lt;/div&gt; &lt;% end %&gt; &lt;br /&gt; </code></pre> <p>I have not tested this and there might be errors elsewhere in your code. Your question is containing a lot of code and you explain what the error is, thats good. But, it is not clear what you want to do. Try to explain a little more and you'll get better answers.</p>
    singulars
    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. VO
      singulars
      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