I'm writing a ruby on rails website for the first time. I have a User model and a Manager model. The user has_one Manager and a Manager belongs_to a User. The Manager model contains more info and flags regarding privileges. I want to allow an admin while viewing a User (show) to be able to make him a manager.

This is what I wrote (probably wrong):

In the view: <%= link_to 'Make Manager', new_manager_path(:id => @user.id) %>

In the controller:

def new
    @user = User.find(params[:id])

    @manager = @user.build_manager

resulting in a managers/new?id=X Url.

Related posts

Recent Viewed