Sha256: 4de611791c1aec8f5e758f4ba51642b8644e603964ec7b308113482f02cf44ea
Contents?: true
Size: 894 Bytes
Versions: 5
Compression:
Stored size: 894 Bytes
Contents
class UsersController < ApplicationController before_filter :require_no_user, :only => [:new, :create] before_filter :require_user, :only => [:show, :edit, :update] def new @user = User.new end def create @user = User.new(params[:user]) @user.save do |result| if result flash[:notice] = "Account registered!" add_lockdown_session_values redirect_back_or_default account_url else render :action => :new end end end def show @user = @current_user end def edit @user = @current_user end def update @user = @current_user # makes our views "cleaner" and more consistent @user.attributes = params[:user] @user.save do |result| if result flash[:notice] = "Account updated!" redirect_to account_url else render :action => :edit end end end end
Version data entries
5 entries across 5 versions & 1 rubygems