Class: Docent::Link

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/docent/link.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details



9
10
11
12
13
14
15
16
17
18
19
# File 'app/models/docent/link.rb', line 9

def self.link_for(controller=nil, action=nil)
  if link = self.where(controller: controller).
            where(action: action).
            first
    link.url
  elsif link = self.where(controller: controller).first
    link.url
  else
    Docent.default_link
  end
end

Instance Method Details

#shortcutObject



5
6
7
# File 'app/models/docent/link.rb', line 5

def shortcut
  "#{controller}##{action}"
end