Module: CanCanDryHelper
- Defined in:
- app/helpers/can_can_dry_helper.rb
Instance Method Summary collapse
- #ability_mapping ⇒ Object
- #can_by_path?(path, method = :get) ⇒ Boolean
- #can_by_path_hash?(path_hash) ⇒ Boolean
- #link_or_nil(name = nil, options = nil, html_options = nil) ⇒ Object
- #link_or_text(name = nil, options = nil, html_options = nil) ⇒ Object
Instance Method Details
#ability_mapping ⇒ Object
4 5 6 |
# File 'app/helpers/can_can_dry_helper.rb', line 4 def ability_mapping @ability_mapping ||= ::AbilityMapping.new end |
#can_by_path?(path, method = :get) ⇒ Boolean
8 9 10 |
# File 'app/helpers/can_can_dry_helper.rb', line 8 def can_by_path?(path, method = :get) can_by_can_args(ability_mapping.can_args_by_path(main_app.root_path, path, method)) end |
#can_by_path_hash?(path_hash) ⇒ Boolean
12 13 14 |
# File 'app/helpers/can_can_dry_helper.rb', line 12 def can_by_path_hash?(path_hash) can_by_can_args(ability_mapping.can_args_by_path_hash(path_hash)) end |
#link_or_nil(name = nil, options = nil, html_options = nil) ⇒ Object
20 21 22 |
# File 'app/helpers/can_can_dry_helper.rb', line 20 def link_or_nil(name = nil, = nil, = nil) link_or_default(name, nil, , ) end |
#link_or_text(name = nil, options = nil, html_options = nil) ⇒ Object
16 17 18 |
# File 'app/helpers/can_can_dry_helper.rb', line 16 def link_or_text(name = nil, = nil, = nil) link_or_default(name, name, , ) end |