title: How to pass dynamic params in Rails?
body: <p>I want some of my model attributes to predefined dynamically. I have various models.And now I want  My <strong>Bill</strong> model to create objects using other model instances.</p>
  
  <p><em>Models :</em></p>
  
  <pre><code>    leave.rb        # belongs_to :residents
      resident.rb     # has_many:leaves,has_many:bills,has_one:account
      bill.rb         # belongs_to:residents
      rate_card.rb    # belongs_to:hostel
      account.rb      # belongs_to:resident
      hostel.rb       
  </code></pre>
  
  <p>now here is my <em>bills controller</em>  create method :</p>
  
  <pre><code>def create
      @bill = Resident.all.each { |resident| resident.bills.create(?) }
      if @bill.save
        flash[:success]="Bills successfully generated"
      else
        flash[:danger]="Something went wrong please try again !"
      end
    end
  </code></pre>
  
  <p>I want to build bill using all of the models <strong>eg:</strong></p>
  
  <pre><code>resident.bills.create(is_date:using form,to_date:using form,expiry_date:using form,amount:30*(resident.rate_card.diet)+resident.rate_card.charge1+resident.rate_card.charge2)+(resident.account.leaves)*10+resident.account.fine)
  ///////Is this possible ?
  </code></pre>
  
  <p><strong><em>And how to use strong params here ?</em></strong></p>
  
  <p>Pls help me out thxx..</p>