app/controllers/archangel/backend/users_controller.rb in archangel-0.3.0 vs app/controllers/archangel/backend/users_controller.rb in archangel-0.4.0

- old
+ new

@@ -7,11 +7,11 @@ module Backend ## # Backend users controller # class UsersController < BackendController - include Archangel::Controllers::Backend::ResourcefulConcern + include Archangel::Controllers::ResourcefulConcern ## # Invite backend user # # Formats @@ -19,11 +19,11 @@ # # Request # POST /backend/users # POST /backend/users.json # - # Paramaters + # Parameters # { # "user": { # "name": "First Last", # "username": "user_name", # "role": "editor", @@ -33,12 +33,10 @@ # } # def create user = resource_new_content - user.invite! user - respond_with user, location: -> { location_after_create } end ## # Update backend user @@ -53,11 +51,11 @@ # PATCH /backend/users/:slug # PATCH /backend/users/:slug.json # PUT /backend/users/:slug # PUT /backend/users/:slug.json # - # Paramaters + # Parameters # { # "user": { # "name": "First Last", # "username": "user_name", # "role": "editor", @@ -74,11 +72,11 @@ respond_with user, location: -> { location_after_update } end protected - def permitted_attributes + def permitted_resource_attributes %w[email locale name remove_avatar role username] end def resources_content @users = current_site.users @@ -98,16 +96,13 @@ authorize @user end def resource_new_content - users = current_site.users - @user = users.new + @user = current_site.users.new if action_name.to_sym == :create - @user = users.invite!(resource_params) do |user| - user.skip_invitation = true - end + @user = current_site.users.invite!(resource_new_params, current_user) end authorize @user end end