Class: SettlementsController

Inherits:
ArtfullyOseController show all
Defined in:
app/controllers/settlements_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



2
3
4
5
6
7
8
9
10
11
12
# File 'app/controllers/settlements_controller.rb', line 2

def index
  unless current_user.current_organization.id.nil?
    @settlements = current_organization.settlements
    @settlements.each{|settlement| authorize! :view, settlement}
    @settlements = @settlements.sort{|a,b| b.created_at <=> a.created_at }
    @settlements = @settlements.paginate(:page => params[:page], :per_page => 25)
  else
    @settlements = nil
    authorize! :view, @settlements
  end
end

#showObject



14
15
16
17
# File 'app/controllers/settlements_controller.rb', line 14

def show
  @settlement = Settlement.find(params[:id])
  authorize! :view, @settlement
end