Class: Refinery::Pages::FinderByPathOrId

Inherits:
Object
  • Object
show all
Defined in:
pages/lib/refinery/pages/finder.rb

Instance Method Summary collapse

Constructor Details

#initialize(path, id) ⇒ FinderByPathOrId



158
159
160
161
# File 'pages/lib/refinery/pages/finder.rb', line 158

def initialize(path, id)
  @path = path
  @id = id
end

Instance Method Details

#findObject



163
164
165
166
167
168
169
170
171
172
173
# File 'pages/lib/refinery/pages/finder.rb', line 163

def find
  if path.present?
    if path.friendly_id?
      FinderByPath.new(path).find
    else
      Page.friendly.find(path)
    end
  elsif id.present?
    Page.friendly.find(id)
  end
end