Sha256: 2988fd46759f37adc3ffbe8710b004f2e8ac2c7986489321c02b4da59fbbfed1

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

# Provides user sign up, the user status pages and sends friendship requests to individual users.
# origin: RM
class UsersController < ApplicationController

  public_controller :only => [:new, :create]
  
  does 'boring_controller'

  permissions :users
  in_sections :members

  new_action do
    before { set_sections_for_sign_up }
  end

  update do
    flash 'Profile updated'
  end

  create do
    before { set_sections_for_sign_up }
    flash 'Welcome!'
    wants.html do
      sign_in(object)
      redirect_to root_path
    end
  end

  show.before do
    in_sections :profile if object == current_user
  end

  def request_friendship
    object.friendship_requests.create! :requesting_user => current_user if current_user.can_become_friends_with? object
    flash[:notice] = 'Contact requests sent'
    redirect_to object_path
  end

  private

  def set_sections_for_sign_up
    in_sections :sign_up, :exclusive => true
  end

  def object_params
    (super || {}).slice(:username, :email, :password, :password_confirmation, :full_name, :town, :country)
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
serum-rails-0.2.1 spec/test_apps/rails-2-3/app/controllers/users_controller.rb
serum-rails-0.2.0 spec/test_apps/rails-2-3/app/controllers/users_controller.rb
serum-rails-0.1.1 spec/test_app/app/controllers/users_controller.rb
serum-rails-0.1.0 spec/test_app/app/controllers/users_controller.rb