Class: RailsConnector::NamedLink

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_connector/named_link.rb

Overview

This class provides methods used to retrieve objects from CMS based an entry in CMS of the obj_class NamedLink.

Defined Under Namespace

Classes: NotFound

Class Method Summary collapse

Class Method Details

This method will be called to retrieve the NamedLink Obj. By default it will look for the Obj at the path “_named_links”. Overwrite this method only if you know what you are doing.


38
39
40
# File 'lib/rails_connector/named_link.rb', line 38

def self.find_named_link_obj
  BasicObj.find_by_path("/_named_links")
end

.get_object(title, options = {}) ⇒ Object

Returns the CMS object mapped to the given title or nil. The title can be a string of symbol.

Raises:


53
54
55
56
57
# File 'lib/rails_connector/named_link.rb', line 53

def self.get_object(title, options = {})
  object = named_links[title.to_s]
  raise NotFound, "The NamedLink '#{title.to_s}' does not exist" if object.nil?
  object
end