rails_generators/lockdown/templates/app/controllers/users_controller.rb in lockdown-0.5.12 vs rails_generators/lockdown/templates/app/controllers/users_controller.rb in lockdown-0.5.13

- old
+ new

@@ -1,6 +1,6 @@ -class UsersController < ApplicationController +class <%= "#{namespace.camelcase}::" unless namespace.blank? %>UsersController < ApplicationController before_filter :find_user, :only => [:show, :edit, :update, :destroy] after_filter :update_user_groups, :only => [:create, :update] # GET /users # GET /users.xml def index @@ -42,11 +42,11 @@ def create @user = User.new(params[:user]) if @user.save flash[:notice] = "Thanks for signing up!" - redirect_to(users_path) + redirect_to(<%= namespace.blank? ? 'user_path(@user)' : "#{namespace}_user_path(@user)" %>) else @user_groups_for_user = Lockdown::System.user_groups_assignable_for_user(current_user) flash[:error] = "Please correct the following issues" render :action => "new" end @@ -58,11 +58,11 @@ @user.attributes = params[:user] respond_to do |format| if @user.save flash[:notice] = 'User was successfully updated.' - format.html { redirect_to(@user) } + format.html { redirect_to(<%= namespace.blank? ? 'user_path(@user)' : "#{namespace}_user_path(@user)"%>) } format.xml { head :ok } else @user_groups_for_user = Lockdown::System.user_groups_assignable_for_user(current_user) format.html { render :action => "edit" } format.xml { render :xml => @user.errors, :status => :unprocessable_entity } @@ -74,10 +74,10 @@ # DELETE /users/1.xml def destroy @user.destroy respond_to do |format| - format.html { redirect_to(users_url) } + format.html { redirect_to(<%= namespace.blank? ? 'users_path' : "#{namespace}_users_path" %>) } format.xml { head :ok } end end def change_password