##// END OF EJS Templates
scm: code clean up app/models/changeset.rb....
Toshi MARUYAMA -
r5254:f31df6c02fa9
parent child
Show More
@@ -147,23 +147,29 class Changeset < ActiveRecord::Base
147 "r#{revision}"
147 "r#{revision}"
148 end
148 end
149 end
149 end
150
150
151 # Returns the previous changeset
151 # Returns the previous changeset
152 def previous
152 def previous
153 @previous ||= Changeset.find(:first, :conditions => ['id < ? AND repository_id = ?', self.id, self.repository_id], :order => 'id DESC')
153 @previous ||= Changeset.find(:first,
154 :conditions => ['id < ? AND repository_id = ?',
155 self.id, self.repository_id],
156 :order => 'id DESC')
154 end
157 end
155
158
156 # Returns the next changeset
159 # Returns the next changeset
157 def next
160 def next
158 @next ||= Changeset.find(:first, :conditions => ['id > ? AND repository_id = ?', self.id, self.repository_id], :order => 'id ASC')
161 @next ||= Changeset.find(:first,
162 :conditions => ['id > ? AND repository_id = ?',
163 self.id, self.repository_id],
164 :order => 'id ASC')
159 end
165 end
160
166
161 # Creates a new Change from it's common parameters
167 # Creates a new Change from it's common parameters
162 def create_change(change)
168 def create_change(change)
163 Change.create(:changeset => self,
169 Change.create(:changeset => self,
164 :action => change[:action],
170 :action => change[:action],
165 :path => change[:path],
171 :path => change[:path],
166 :from_path => change[:from_path],
172 :from_path => change[:from_path],
167 :from_revision => change[:from_revision])
173 :from_revision => change[:from_revision])
168 end
174 end
169
175
General Comments 0
You need to be logged in to leave comments. Login now