- def index
- @changesets = Changeset.find(:all, :order => "closed_at DESC", :conditions => ['closed_at < ?', DateTime.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