Creating a new Y object from X's controller

If I am in the controller for Model X, and inside a method there I want to create a new instance of (i.e. insert a new row into the DB table for) Model Y, how do I express this? Thanks, R.Vince

Y.new

controllers don't care what models you use.

-eric

Like Eric said.

Y.new Y.attribute1 = attribute1value Y.attribute2 = attribute2value Y.save

..etc

Or

Y.new(params[:y]) Y.save

One controller can manage multiple models, and one model can be managed by multiple controllers. I frequently set up additional Restful controllers to manage single attribute changes within a model, even though another controller manages other parts of the model.