This commit is contained in:
albert
2011-05-29 03:47:06 -04:00
parent 969185ad24
commit 9e287726e3
18 changed files with 237 additions and 137 deletions

View File

@@ -1,5 +1,5 @@
class Note < ActiveRecord::Base
attr_accessor :updater_id, :updater_ip_addr
attr_accessor :updater_id, :updater_ip_addr, :html_id
belongs_to :post
belongs_to :creator, :class_name => "User"
belongs_to :updater, :class_name => "User"
@@ -11,10 +11,10 @@ class Note < ActiveRecord::Base
after_save :update_post
after_save :create_version
validate :post_must_not_be_note_locked
attr_accessible :x, :y, :width, :height, :body, :updater_id, :updater_ip_addr, :is_active, :post_id
attr_accessible :x, :y, :width, :height, :body, :updater_id, :updater_ip_addr, :is_active, :post_id, :html_id
scope :active, where("is_active = TRUE")
scope :body_matches, lambda {|query| where("text_index @@ plainto_tsquery(?)", query.scan(/\S+/).join(" & "))}
search_method :body_matches
search_methods :body_matches
def presenter
@presenter ||= NotePresenter.new(self)