[Rails] How to create an object in one model at the same time as another

2013-03-10 Thread Dave Castellano
Hi, I'm using Devise and Cancan in my project. I'm a beginner still. I'm trying to create a new Profile object each time a new user is created. Anyone know where to do this, as there is no new action in User controller. I have a user model and a Profile model User model: user has_one

Re: [Rails] How to create an object in one model at the same time as another

2013-03-10 Thread Jodi Showers
use a model callback - http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html :after_create :create_profile private def create_profile ... end On Sun, Mar 10, 2013 at 10:14 AM, Dave Castellano li...@ruby-forum.comwrote: Hi, I'm using Devise and Cancan in my project. I'm a

Re: [Rails] How to create an object in one model at the same time as another

2013-03-10 Thread Colin Law
On 10 March 2013 14:14, Dave Castellano li...@ruby-forum.com wrote: Hi, I'm using Devise and Cancan in my project. I'm a beginner still. I'm trying to create a new Profile object each time a new user is created. Anyone know where to do this, as there is no new action in User controller.