开发者

Update the User controller of devise

I use Ra开发者_JS百科ils 3.0.3 and devise 1.1.5 (devise on github)

My User model belongs_to the Company model with the foreign_key company_id

When a new User is created (at Sign Up), I need to associate him with a new company.

So, basically, I need to put the following code somewhere

@user.company = Company.new
@user.save

The user controller is manage in the devise dependency, is it possible to generate the controller used by devise in my app/controllers directory

Thanks


You can customize devise controllers - just copy the default ones from devise/app/controllers into your own application directory and add your own code to them.


Because a company has to be associated for each new user, I put this code in the User model in a before_create filter.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜