Class: Refinery::Pages::Finder::FinderByPathOrId
- Inherits:
-
Object
- Object
- Refinery::Pages::Finder::FinderByPathOrId
- Defined in:
- pages/lib/refinery/pages/finder.rb
Instance Method Summary collapse
- #find ⇒ Object
-
#initialize(path, id) ⇒ FinderByPathOrId
constructor
A new instance of FinderByPathOrId.
Constructor Details
#initialize(path, id) ⇒ FinderByPathOrId
Returns a new instance of FinderByPathOrId.
156 157 158 159 |
# File 'pages/lib/refinery/pages/finder.rb', line 156 def initialize(path, id) @path = path @id = id end |
Instance Method Details
#find ⇒ Object
161 162 163 164 165 166 167 168 169 170 171 |
# File 'pages/lib/refinery/pages/finder.rb', line 161 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 |