- def index
- @changesets = Changeset.find(:all, :order => "closed_at DESC", :conditions => ['closed_at < ?', Time.now], :limit=> 20)
- end
-
- def relation
- begin
- @relation = Relation.find(params[:id])
-
- @name = @relation.tags['name'].to_s
- if @name.length == 0:
- @name = "#" + @relation.id.to_s
- end
-
- @title = 'Relation | ' + (@name)
- @next = Relation.find(:first, :order => "id ASC", :conditions => [ "visible = true AND id > :id", { :id => @relation.id }] )
- @prev = Relation.find(:first, :order => "id DESC", :conditions => [ "visible = true AND id < :id", { :id => @relation.id }] )
- rescue ActiveRecord::RecordNotFound
- @type = "relation"
- render :action => "not_found", :status => :not_found
- end
+ def relation
+ @type = "relation"
+ @relation = Relation.find(params[:id])
+ @next = Relation.visible.where("id > ?", @relation.id).order(:id => :asc).first
+ @prev = Relation.visible.where("id < ?", @relation.id).order(:id => :desc).first
+ rescue ActiveRecord::RecordNotFound
+ render :action => "not_found", :status => :not_found