From 17a5bb7652293de6b1129df9cc7cbd752c676394 Mon Sep 17 00:00:00 2001 From: Joachim Filip Ignacy Bartosik Date: Tue, 26 Jul 2011 17:16:57 +0200 Subject: Use hobo scopes where possible Not Model.find :conditions => { ... } --- site/app/models/agenda.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'site') diff --git a/site/app/models/agenda.rb b/site/app/models/agenda.rb index 29c57f5..4039d0c 100644 --- a/site/app/models/agenda.rb +++ b/site/app/models/agenda.rb @@ -77,7 +77,7 @@ class Agenda < ActiveRecord::Base def self.update_voting_options(options) agenda = Agenda.current options.each do |item_info| - item = AgendaItem.first :conditions => { :agenda_id => agenda, :title => item_info.first } + item = AgendaItem.agenda_id_is(agenda).title_is(item_info.first).first item.update_voting_options(item_info[1]) end end @@ -85,10 +85,10 @@ class Agenda < ActiveRecord::Base def self.process_results(results) agenda = Agenda.current for item_title in results.keys - item = AgendaItem.first :conditions => { :agenda_id => agenda, :title => item_title } + item = AgendaItem.agenda_id_is(agenda.id).title_is(item_title).first votes = results[item_title] for voter in votes.keys - option = VotingOption.first :conditions => { :agenda_item_id => item.id, :description => votes[voter] } + option = VotingOption.agenda_item_id_is(item.id).description_is(votes[voter]).first user = ::User.find_by_irc_nick voter Vote.vote_for_option(user, option, true) end -- cgit v1.2.3-65-gdbad