Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Michael Hall
PLUS
Michael Hall
Courses Plus Student 30,909 Points

after_create using Rails_Admin

I'm using Rails 4.1 and Rails Admin. I have a Project Model with the following fields: name: slug: project_number.

When I create a new project in the admin I want the project_number to be created automatically using the id and the slug. Like this: self.project_number = self.slug + '_' + self.id

I was trying to do this in the project controller using an after_create method, I'm now realising that rails_admin is not hitting my controller. Can anyone point me in the right direction on how to do this? Would this be a rails_admin custom action?