aboutsummaryrefslogtreecommitdiff
path: root/site
diff options
context:
space:
mode:
authorJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2011-07-26 17:16:57 +0200
committerJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2011-07-26 17:16:57 +0200
commit17a5bb7652293de6b1129df9cc7cbd752c676394 (patch)
tree0fc3c96fc3215cdb8ec39d42c4935f0539ed87bc /site
parentCleanup Agenda.update_voting_options (diff)
downloadcouncil-webapp-17a5bb7652293de6b1129df9cc7cbd752c676394.tar.gz
council-webapp-17a5bb7652293de6b1129df9cc7cbd752c676394.tar.bz2
council-webapp-17a5bb7652293de6b1129df9cc7cbd752c676394.zip
Use hobo scopes where possible
Not Model.find :conditions => { ... }
Diffstat (limited to 'site')
-rw-r--r--site/app/models/agenda.rb6
1 files changed, 3 insertions, 3 deletions
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