Sha256: ca50bf3179567a851207f4d45b26d0e6c351c6c22cc8ce89e91fb6f18de388fa

Contents?: true

Size: 718 Bytes

Versions: 2

Compression:

Stored size: 718 Bytes

Contents

class GroupsController < InheritedResources::Base
  
  respond_to :html, :xml, :js
  
  def index
    if params[:search]
      @groups = Group.search("%"+params[:search]+"%").paginate(:per_page => 10, :page => params[:page])
    else
      if params[:letter] && params[:letter]!="undefined"
        @groups = Group.search(params[:letter]+"%").paginate(:per_page => 10, :page => params[:page])
      else
        @groups = Group.alphabetic.paginate(:per_page => 10, :page => params[:page])
      end
    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

2 entries across 2 versions & 1 rubygems

Version Path
social_stream-0.4.1 app/controllers/groups_controller.rb
social_stream-0.4.0 app/controllers/groups_controller.rb