Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- before_action :set_user, only: [:show, :edit, :update, :destroy]
- # DELETE /users/:id.:format
- def destroy
- # authorize! :delete, @user
- @user.destroy
- respond_to do |format|
- format.html { redirect_to root_url }
- end
- end
- private
- def set_user
- @user = User.find(params[:id])
- end
- def user_params
- accessible = [ :name, :email ]
- accessible << [ :password, :password_confirmation ] unless params[:user][:password].blank?
- params.require(:user).permit(accessible)
- end
- validates :auth_token, uniqueness: true
- devise :database_authenticatable, :registerable,
- :recoverable, :rememberable, :trackable, :validatable
- before_create :generate_authentication_token!
- def generate_authentication_token!
- begin
- self.auth_token = Devise.friendly_token
- end while self.class.exists?(auth_token: auth_token)
- end
- Started GET "/users/sign_up" for 127.0.0.1 at 2015-06-30 09:31:46 -0500
- Processing by Devise::RegistrationsController#new as HTML
- Rendered devise/registrations/new.html.haml within layouts/application (12.9ms)
- User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."deleted_at" IS NULL AND "users"."auth_token" IS NULL LIMIT 1
- Rendered layouts/_navigation_links.html.haml (2.1ms)
- Rendered layouts/_navigation.html.haml (3.4ms)
- Rendered layouts/_messages.html.haml (0.2ms)
- Completed 200 OK in 132ms (Views: 117.0ms | ActiveRecord: 1.5ms)
- Started POST "/users" for 127.0.0.1 at 2015-06-30 09:32:00 -0500
- Processing by Devise::RegistrationsController#create as HTML
- Parameters: {"utf8"=>"✓", "authenticity_token"=>"20w9AXmACwggvPocKfLBdrxQRasT5OiaC7niuzooBBm3BAp8xkN6VLWyxZLRoLIpFPEIIdkxZRd9CCwsJxkeUA==", "user"=>{"email"=>"hola@x.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Sign up"}
- (0.1ms) BEGIN
- User Exists (0.4ms) SELECT 1 AS one FROM "users" WHERE "users"."auth_token" = '' LIMIT 1
- User Exists (0.3ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = 'hola@x.com' LIMIT 1
- (0.1ms) ROLLBACK
- Rendered devise/registrations/new.html.haml within layouts/application (3.2ms)
- User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."deleted_at" IS NULL AND "users"."auth_token" IS NULL LIMIT 1
- Rendered layouts/_navigation_links.html.haml (1.5ms)
- Rendered layouts/_navigation.html.haml (2.1ms)
- Rendered layouts/_messages.html.haml (0.2ms)
- Completed 200 OK in 232ms (Views: 134.4ms | ActiveRecord: 1.2ms)
- Started GET "/assets/jquery/jquery-bb5529929fa5581a780a38ecb7470f2c.js?body=1" for 127.0.0.1 at 2015-06-30 09:32:00 -0500
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement