Sha256: 85f9c19818bb6cc80c524de24c523eb2785a96b83203af1e7bf4199932686268

Contents?: true

Size: 1 KB

Versions: 8

Compression:

Stored size: 1 KB

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 -%>
      flash[:notice] = "Thank you for signing up! You are now logged in."
      redirect_to "/"
    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 %>])
      flash[:notice] = "Your profile has been updated."
      redirect_to "/"
    else
      render :action => 'edit'
    end
  end
end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
dust-generators-0.0.1 lib/generators/dust/authentication/templates/users_controller.rb
nifty-generators-0.4.4 lib/generators/nifty/authentication/templates/users_controller.rb
nifty-generators-0.4.3 lib/generators/nifty/authentication/templates/users_controller.rb
seivan-generators-0.5 lib/generators/seivan/authentication/templates/users_controller.rb
seivan-generators-0.4 lib/generators/seivan/authentication/templates/users_controller.rb
seivan-generators-0.3 lib/generators/seivan/authentication/templates/users_controller.rb
seivan-generators-0.2 lib/generators/seivan/authentication/templates/users_controller.rb
nifty-generators-0.4.2 lib/generators/nifty/authentication/templates/users_controller.rb