Module: CanCanDryHelper

Defined in:
app/helpers/can_can_dry_helper.rb

Instance Method Summary collapse

Instance Method Details

#ability_mappingObject



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

Returns:

  • (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

Returns:

  • (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


20
21
22
# File 'app/helpers/can_can_dry_helper.rb', line 20

def link_or_nil(name = nil, options = nil, html_options = nil)
  link_or_default(name, nil, options, html_options)
end


16
17
18
# File 'app/helpers/can_can_dry_helper.rb', line 16

def link_or_text(name = nil, options = nil, html_options = nil)
  link_or_default(name, name, options, html_options)
end