Class: FeatureBox::ApplicationController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- FeatureBox::ApplicationController
show all
- Includes:
- Helpers
- Defined in:
- app/controllers/feature_box/application_controller.rb
Instance Method Summary
collapse
Methods included from Helpers
define_helpers, included
Instance Method Details
#current_ability ⇒ Object
13
14
15
|
# File 'app/controllers/feature_box/application_controller.rb', line 13
def current_ability
FeatureBox::Ability.new(current_user)
end
|
#pages_helper(&code) ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
|
# File 'app/controllers/feature_box/application_controller.rb', line 17
def pages_helper(&code)
@current_page = (params[:page]==nil)?0:(params[:page].to_i)
@current_page = @current_page<1?1:@current_page
limit = Settings.max_suggestions_on_page
offset=@current_page*limit-limit
offset=offset<0?0:offset
code.call limit, offset
@last_page = (@total / limit.to_f).ceil
end
|
#retrieve_vars ⇒ Object
29
30
31
|
# File 'app/controllers/feature_box/application_controller.rb', line 29
def retrieve_vars
@categories = Array [Category.default] + Category.all
end
|