Skip to content

Commit

Permalink
Добавил named_scope для получения валют по каторым возможен обмен (т.…
Browse files Browse the repository at this point in the history
…е. прописан способ обмена)
  • Loading branch information
parallel588 committed Dec 9, 2009
1 parent 3aeec91 commit cf57465
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/models/currency.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ class Currency < ActiveRecord::Base
currency_receiver_id = (#{ self.id })
}

# Только те валюты по которым возможен обмен, т.е. есть путь обмена
named_scope :be_exchanged, lambda{
ids = PathWay.all(:select => "distinct currency_source_id").map {|x| x.currency_source_id }
return [] if ids.blank?
{ :conditions => { :id => ids }}
}

def parameters(field=nil)
if field.blank?
Expand Down

0 comments on commit cf57465

Please sign in to comment.