Skip to content

Instantly share code, notes, and snippets.

@totallymike
Created February 9, 2013 20:37
Show Gist options
  • Save totallymike/4747018 to your computer and use it in GitHub Desktop.
Save totallymike/4747018 to your computer and use it in GitHub Desktop.
class User < ActiveRecord::Base
attr_accessible :role_id, :as => :admin
belongs_to :role
end
class Role < ActiveRecord::Base
has_many :users
end
class UsersController < ApplicationController
def update
@user = User.find(params[:id])
if @user.update_attributes(param[:user])
#this stuff happens
else
# this stuff SHOULD happen.
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment