Class: Docent::Link
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Docent::Link
- Defined in:
- app/models/docent/link.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.link_for(controller = nil, action = nil) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/models/docent/link.rb', line 9 def self.link_for(controller=nil, action=nil) if (links = self.where(controller: controller). where(self.arel_table[:action].eq(action)). where(self.arel_table[:action].not_eq(''))).length > 0 links.first.url elsif (links = self.where(controller: controller). where(self.arel_table[:action].eq(''))).length > 0 links.first.url else Docent.default_link end end |
Instance Method Details
#shortcut ⇒ Object
5 6 7 |
# File 'app/models/docent/link.rb', line 5 def shortcut "#{controller}##{action}" end |