Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Thnx for all the help ... </p> <p>this is what finally worked : </p> <p>I added this to my qualifications controller ... </p> <pre><code>class QualificationsController &lt; InheritedResources::Base def new @qualification = Qualification.new(:employee_id =&gt; params[:id]) end def create @qualification = Qualification.new(params[:qualification]) respond_to do |format| if @qualification.save format.html { redirect_to @qualification, notice: 'Qualification was successfully created.' } format.json { render json: @qualification, status: :created, location: @qualification } else format.html { render action: "new" } format.json { render json: @qualification.errors, status: :unprocessable_entity } end end end end </code></pre> <p>then I added this to my employee_show view page ... </p> <pre><code>&lt;%= link_to "Add A New Qualification for this Employee", new_qualification_url(:id =&gt; @employee.id) %&gt; </code></pre> <p>And i added this to my qualifications form : </p> <pre><code> &lt;%= simple_form_for @qualification, :html =&gt; { :class =&gt; 'form-horizontal' } do |f| %&gt; &lt;%= f.association :employee,label_method: :emp_full_name, value_method: :id, include_blank: false, :as =&gt; :hidden%&gt; &lt;%= f.association :employee,label_method: :emp_full_name, value_method: :id, include_blank: false, disabled: true%&gt; </code></pre> <p>And after adding the employee this is what helped me go back to the employee from where i came :</p> <pre><code>&lt;%= link_to t('.back', :default =&gt; t("helpers.links.back")), employee_path(@qualification.employee_id), :class =&gt; 'btn' %&gt; </code></pre> <p>Im using simple_form which is an awesome DSL FTW :D :D :D .....</p> <p>And everything is fine as wanted :) ... Thnx for everyone's help ... I posted here so tht someone like my problem can sort out in future :D ...</p> <p>Regards</p>
 

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