Class Remark
In: app/models/remark.rb
Parent: ActiveRecord::Base

Remarks function like very short comments and are meanth as one-liners…

Methods

Protected Instance methods

Logs creation to log.logilogi.org

[Source]

    # File app/models/remark.rb, line 43
43:   def log_create_to_log_log
44:     if GlobalConfig.use_log_log
45:       # four previous replyers and logi creator receive notice
46:       remarks = self.logi.remarks.find(:all,
47:           :limit => 5, :order => ["created_at DESC"])
48:       names = [self.logi.creator.unix_name] +
49:           remarks[1..-1].collect {|r| r.user.unix_name}
50:       channels = ['all', 'remarks'] +
51:           names.uniq.collect {|n| 'for_' + n}
52:       m = LogLogMessage.new(
53:           :kind => "Remark",
54:           :channel_names => channels.join(','),
55:           :author => self.user.name,
56:           :title => 'On: ' + self.logi.current_title,
57:           :text => self.message,
58:           :url => GlobalConfig.site_url + self.logi.link.to_s)
59:       m.save
60:     end
61:   end

Validation-functions

[Source]

    # File app/models/remark.rb, line 67
67:   def validate
68:     # length
69:     if GlobalConfig.done_with_basics?
70:       if self.message.size > GlobalConfig.maximum_message_size
71:         self.errors.add(:message, t('m.remark.error_too_long',
72:             :max => GlobalConfig.maximum_message_size))
73:       end
74:     end
75:     # no html-tags
76:     if self.message =~ Const::LogiVersion::HTML_TAG
77:       self.errors.add(:message, t('m.remark.html_tags_not_allowed'))
78:     end
79:     # links
80:     if self.message =~ Const::LogiVersion::LINK_RE
81:       self.errors.add(:message, t('m.remark.links_not_allowed'))
82:     end
83:   end

[Validate]