Skip to content

Instantly share code, notes, and snippets.

@jparbros
Last active March 1, 2016 22:07
Show Gist options
  • Select an option

  • Save jparbros/fd9cf79c6e81e576a639 to your computer and use it in GitHub Desktop.

Select an option

Save jparbros/fd9cf79c6e81e576a639 to your computer and use it in GitHub Desktop.
class User < ActiveRecord::Base
ATTR_ACCESSIBLE = [:first_name,
:last_name,
:login,
:email,
:password,
:password_confirmation,
:organization_id,
:time_zone,
:user_locale,
:activated_at,
:organization,
:organization_id,
:receives_newsletter,
:password_reset_code,
:permission_ids,
:office_id,
:email_signature,
:show_welcome,
:email_daily_tasks,
:admin,
:mobile_phone,
:email_weekly_summary]
end
class User < ActiveRecord::Base
attr_accessible :first_name,
:last_name,
:login,
:email,
:password,
:password_confirmation,
:organization_id,
:time_zone,
:user_locale,
:activated_at,
:organization,
:organization_id,
:receives_newsletter,
:password_reset_code,
:permission_ids,
:office_id,
:email_signature,
:show_welcome,
:email_daily_tasks,
:admin,
:mobile_phone,
:email_weekly_summary
end
class Agent::UsersController < Agent::ManagerApplicationController
private
def user_params
params.require(:user).permit(User::ATTR_ACCESSIBLE)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment