Sha256: 6d819b766d1c177bc8d6d13e1b9656b8ca95d9c83d2f3461b32d57813434550a

Contents?: true

Size: 1015 Bytes

Versions: 9

Compression:

Stored size: 1015 Bytes

Contents

class <%= user_plural_class_name %>Controller < ApplicationController
  before_filter :login_required, :except => [:new, :create]

  def new
    @<%= user_singular_name %> = <%= user_class_name %>.new
  end

  def create
    @<%= user_singular_name %> = <%= user_class_name %>.new(params[:<%= user_singular_name %>])
    if @<%= user_singular_name %>.save
    <%- unless options[:authlogic] -%>
      session[:<%= user_singular_name %>_id] = @<%= user_singular_name %>.id
    <%- end -%>
      redirect_to root_url, :notice => "Thank you for signing up! You are now logged in."
    else
      render :action => 'new'
    end
  end

  def edit
    @<%= user_singular_name %> = current_<%= user_singular_name %>
  end

  def update
    @<%= user_singular_name %> = current_<%= user_singular_name %>
    if @<%= user_singular_name %>.update_attributes(params[:<%= user_singular_name %>])
      redirect_to root_url, :notice => "Your profile has been updated."
    else
      render :action => 'edit'
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
flockonus-nifty-generators-0.0.12 lib/generators/nifty/authentication/templates/users_controller.rb
nifty-generators-0.4.6 lib/generators/nifty/authentication/templates/users_controller.rb
flockonus-nifty-generators-0.0.11 lib/generators/nifty/authentication/templates/users_controller.rb
flockonus-nifty-generators-0.0.10 lib/generators/nifty/authentication/templates/users_controller.rb
flockonus-nifty-generators-0.0.9 lib/generators/nifty/authentication/templates/users_controller.rb
nifty-generators-0.4.5 lib/generators/nifty/authentication/templates/users_controller.rb
flockonus-nifty-generators-0.0.8 lib/generators/nifty/authentication/templates/users_controller.rb
flockonus-nifty-generators-0.0.7 lib/generators/nifty/authentication/templates/users_controller.rb
flockonus-nifty-generators-0.0.6 lib/generators/nifty/authentication/templates/users_controller.rb