Created
May 6, 2015 02:28
-
-
Save mootpointer/9b02b3fbe76ede1b2feb to your computer and use it in GitHub Desktop.
Revisions
-
mootpointer created this gist
May 6, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ require 'active_support/core_ext/hash/slice' module MyCompany module Services class UpdateUser attr_reader :user, :params def initialize user, params @user, @params = user, params end def allowed_params [ "first_name", "last_name", "avatar_url", "email" ] end def cleaned_params @params.slice(*allowed_params) end def call user.update!(cleaned_params) end end end end