rails - REST or create another method
- by user1304740
Let's assume we have two models linked with a 1-to-many relationship (like clients and invoices - a client can have many invoices).
In a view of a 'client' (let's say the 'show' view), there is a form to capture an 'invoice'.
I found 2 approaches:
This form should be handled by the 'invoice' controller (method create), having client_id passed as a parameter
This form should be handled by a new method in 'client' controller, probably a PUT method defined in routes.rb.
Is there a 'Rails way', or both of them are good? Is there a preffered way?
Thanks!