Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 173
- Log:
Updated to latest release of Beast according to the "getting started with
Beast" guide at:http://beast.caboo.se/forums/1/topics/381
This check-in includes frozen Edge Rails and has the beginnings of
configuration for the ROOL site included.
- Author:
- rool
- Date:
- Fri Mar 02 15:59:12 +0000 2007
- Size:
- 1368 Bytes
1 | class Topic < ActiveRecord::Base |
2 | belongs_to :forum, :counter_cache => true |
3 | belongs_to :user |
4 | has_many :monitorships |
5 | has_many :monitors, :through => :monitorships, :conditions => ['monitorships.active = ?', true], :source => :user, :order => 'users.login' |
6 | |
7 | has_many :posts, :order => 'posts.created_at', :dependent => :destroy do |
8 | def last |
9 | @last_post ||= find(:first, :order => 'posts.created_at desc') |
10 | end |
11 | end |
12 | |
13 | belongs_to :replied_by_user, :foreign_key => "replied_by", :class_name => "User" |
14 | |
15 | validates_presence_of :forum, :user, :title |
16 | before_create :set_default_replied_at_and_sticky |
17 | after_save :set_post_topic_id |
18 | |
19 | attr_accessible :title |
20 | # to help with the create form |
21 | attr_accessor :body |
22 | |
23 | def voices |
24 | posts.map { |p| p.user_id }.uniq.size |
25 | end |
26 | |
27 | def hit! |
28 | self.class.increment_counter :hits, id |
29 | end |
30 | |
31 | def sticky?() sticky == 1 end |
32 | |
33 | def views() hits end |
34 | |
35 | def paged?() posts_count > 25 end |
36 | |
37 | def last_page |
38 | (posts_count.to_f / 25.0).ceil.to_i |
39 | end |
40 | |
41 | def editable_by?(user) |
42 | user && (user.id == user_id || user.admin? || user.moderator_of?(forum_id)) |
43 | end |
44 | |
45 | protected |
46 | def set_default_replied_at_and_sticky |
47 | self.replied_at = Time.now.utc |
48 | self.sticky ||= 0 |
49 | end |
50 | |
51 | def set_post_topic_id |
52 | Post.update_all ['forum_id = ?', forum_id], ['topic_id = ?', id] |
53 | end |
54 | end |