public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Petteri Räty" <betelgeuse@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/council-webapp:master commit in: site/app/models/
Date: Mon,  1 Aug 2011 14:38:16 +0000 (UTC)	[thread overview]
Message-ID: <17a5bb7652293de6b1129df9cc7cbd752c676394.betelgeuse@gentoo> (raw)

commit:     17a5bb7652293de6b1129df9cc7cbd752c676394
Author:     Joachim Filip Ignacy Bartosik <jbartosik <AT> gmail <DOT> com>
AuthorDate: Tue Jul 26 15:16:57 2011 +0000
Commit:     Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Tue Jul 26 15:16:57 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/council-webapp.git;a=commit;h=17a5bb76

Use hobo scopes where possible

Not Model.find :conditions => { ... }

---
 site/app/models/agenda.rb |    6 +++---
 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



             reply	other threads:[~2011-08-01 14:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-01 14:38 Petteri Räty [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-08-01 14:38 [gentoo-commits] proj/council-webapp:master commit in: site/app/models/ Petteri Räty
2011-08-01 14:38 Petteri Räty
2011-08-01 14:38 Petteri Räty
2011-08-01 14:38 Petteri Räty
2011-06-18 15:42 Petteri Räty

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=17a5bb7652293de6b1129df9cc7cbd752c676394.betelgeuse@gentoo \
    --to=betelgeuse@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox