Sha256: 242c83bdd2e03504ec2fe7718bf702a544d84bc241947867749af64b00df50cb

Contents?: true

Size: 880 Bytes

Versions: 5

Compression:

Stored size: 880 Bytes

Contents

class GroupsController < InheritedResources::Base
  load_and_authorize_resource

  respond_to :html, :js

  def index
    @groups = Group.most(params[:most]).
                    alphabetic.
                    letter(params[:letter]).
                    search(params[:search]).
                    tagged_with(params[:tag]).
                    paginate(:per_page => 10, :page => params[:page])

    index! do |format|
      format.html { render :layout => (user_signed_in? ? 'application' : 'frontpage') }
    end
  end

  def create
    create! do |success, failure|
      success.html {
        self.current_subject = @group
        redirect_to :home
      }
    end
  end

  protected

  # Overwrite resource method to support slug
  # See InheritedResources::BaseHelpers#resource
  def resource
    @group ||= end_of_association_chain.find_by_slug!(params[:id])
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
social_stream-base-0.5.2 app/controllers/groups_controller.rb
social_stream-base-0.5.1 app/controllers/groups_controller.rb
social_stream-base-0.5.0 app/controllers/groups_controller.rb
social_stream-0.4.6 app/controllers/groups_controller.rb
social_stream-0.4.5 app/controllers/groups_controller.rb