title: How to pass parameters in controller in Ruby On Rails
body: <p>I am trying to pass parameters in controller but it is not returning anything.Please help me how I can pass parameters .
  Controller Code -</p>
  
  <pre><code> def print_salary_slip_monthwise
        @month = params[:salary][:month]
        @year = params[:salary][:year]
        @company = params[:salary][:company_id]
        @company_location = params[:salary][:company_location_id]
        @department = params[:salary][:department_id]
        @salaryslips = Salaryslip.where(month:  @month,year: @year.to_s,employee_id: @salary1)
  
      end 
  </code></pre>
  
  <p>form.html.erb - This is my form in which I used on change event . </p>
  
  <pre><code>&lt;div class="box"&gt;
    &lt;div class="box-header"&gt;
      &lt;h3 class="box-title"&gt;Salary Slip Department Wise&lt;/h3&gt;
    &lt;/div&gt;&lt;!-- /.box-header --&gt;
    &lt;div class="box-body"&gt;
  &lt;%= bootstrap_form_for(:pdf_salaries, url: { action: 'print_salary_slip_monthwise'},html: {id: 'pdf_salaries'},remote: true ) do |f| %&gt;
       &lt;div class="row"&gt;
  
        &lt;div class="col-sm-2"&gt;
        &lt;label&gt;Year&lt;/label&gt;
          &lt;div class="field"&gt;
            &lt;%= select :salary,:year,['2015','2016','2017','2018','2019','2020','2021','2022','2023','2024','2025','2026','2027'],{label: 'Select Year',include_blank: " Select Year"},{class: 'form-control'} %&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="col-sm-2"&gt;
        &lt;label&gt;Month&lt;/label&gt;
          &lt;div class="field"&gt;
            &lt;%= select :salary,:month, ['January','February','March','April','May','June','July','August','September','October','November','December'],{label: 'Select Month',include_blank: " Select Month"}, class: "form-control" %&gt;
           &lt;/div&gt;
        &lt;/div&gt;
  
         &lt;div class="col-sm-2"&gt;
              &lt;div class="form-group required"&gt;
              &lt;div class="input-group"&gt;
                &lt;%= f.select :company_id, all_company,{include_blank: "Select Company"},{onchange:"var a={id:$(this).val(), form : 'employee'}; $.get('/employees/collect_company_location',a,function(response){});"}%&gt;
              &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;
  
        &lt;div class="col-sm-2"&gt;
              &lt;div class="form-group required"&gt;
                &lt;div id="company_location"&gt;
                  &lt;%= render 'employees/company_location_dropdown' %&gt; 
              &lt;/div&gt; 
              &lt;/div&gt;
            &lt;/div&gt;
  
         &lt;div class="col-sm-3"&gt;
              &lt;div class="form-group required"&gt;
              &lt;div class="input-group"&gt;
                &lt;div id="department"&gt;
                  &lt;%= render 'employees/department_dropdown' %&gt; 
              &lt;/div&gt; 
              &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="row"&gt;
         &lt;div class="col-sm-2"&gt;
            &lt;div class="actions"&gt;
              &lt;%= f.submit "Display Report", class: "btn btn-sm btn-primary",id: "buttonCtc" %&gt;
            &lt;/div&gt;
          &lt;/div&gt;
          &lt;/div&gt;
           &lt;div class="ajax-progress"&gt;&lt;/div&gt;
         &lt;div id="employee_list_pdf"&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;%end%&gt;
  </code></pre>