app/models/page.rb in tkh_content-0.10.2 vs app/models/page.rb in tkh_content-0.10.3
- old
+ new
@@ -95,11 +95,11 @@
### autocomplete related instance methods
def parent_page_title
parent.try(:title) unless self.orphan?
end
def parent_page_title=(title)
- if title.present? && Page.find_by_title(title)
- self.parent_id = Page.find_by_title(title).id
+ if title.present? && Page.where(title: title)
+ self.parent_id = Page.where(title: title).first.id
else
self.parent_id = nil
end
end