dimanche 5 mars 2017

Rails find id on the model

On controller usually use params to get id and on the model? i've trying to get using:

in either case did not get id, someone knows why?

def nook
   product = Product.find_by_id(:id)
nook.product_id
end

 def product
    prod = Product.find_by_id(attributes['product_id'])


  end

Aucun commentaire:

Enregistrer un commentaire