Sha256: 31c701ab56cc91e8adf62ccc22abc96a00d3110b3ec24922b217ac5a261da8a9

Contents?: true

Size: 758 Bytes

Versions: 1

Compression:

Stored size: 758 Bytes

Contents

module Catarse
class BackersController < BaseController
  inherit_resources
  defaults :resource_class => Backer, :collection_name => 'backs', :instance_name => 'back'
  belongs_to :user
  actions :index
  respond_to :json, :only => [:index]

  def index
    index! do |format|
      format.json{ return render :json => @backs.to_json({:include_project => true, :can_manage => (current_user == @user)}) }
      format.html{ return render :nothing => true, :status => 404 }
    end
  end

  protected
  def collection
    @backs = end_of_association_chain.confirmed.order("confirmed_at DESC")
    @backs = @backs.not_anonymous unless @user == current_user or (current_user and current_user.admin)
    @backs = @backs.page(params[:page]).per(10)
  end
end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
catarse_core-1.0.0.beta app/controllers/catarse/backers_controller.rb