Creation of owned model

2010/05/10 at 6:53 pm (Hobo, Programming, Ruby on Rails, WebApplication)

I didn’t use owner actions because they are designed to take owner as parameter and I want current_user to always be owner of created object. Solution for that is quite simple. Luckily hobo_new takes a parameter – a record to be created.
def new
hobo_new Friend.new(:owner => current_user)
end

Does exactly what I needed.

Leave a comment