ruby on rails - Setting attribute equal to another -


so have inventory application api. under specific circumstance need raise unit_price of inventory $10. have named circumstance have set condition either 0 or 10 , variable saved in attribute y factor. testing purposes have set yfactor 10.

    def price        inventory.unit_price= inventory.unit_price + yfactor.to_f       respond_to |format|          format.json{render}       end     end 

i undefined method (unit_price) error.

using rails 4.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -