I want to ask two things:
1) In the MVC logic of Rails , is correct to call a Model into another Model? In other words:
Model A.rb
def function1 ... end
Model B.rb
def function2 A.function1 end
This is just an example and there isn't any association between the two Models.
The second question is:
2) When i call in the Rails console: c = Supply.where(product_id: 7) i have this result
and i'm not able to call: c.quantity
If i use c = Supply.find(1) i can call c.quantity
What is the difference?
Thanks all
Aucun commentaire:
Enregistrer un commentaire