On 01/05/2012 10:53 AM, Tomas Hrcka wrote:
From: John Eckersberg<jeckersb(a)redhat.com>
This allows Provider to be valid when the scope is actually invoked.
Without this, Provider is evaluated at ProviderAccount class load
time. With db:setup, the Providers table has not been created yet so
this fails.
---
src/app/models/provider_account.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/app/models/provider_account.rb b/src/app/models/provider_account.rb
index 8332135..c44be65 100644
--- a/src/app/models/provider_account.rb
+++ b/src/app/models/provider_account.rb
@@ -68,7 +68,7 @@ class ProviderAccount< ActiveRecord::Base
before_create :no_account?
before_destroy :destroyable?
- scope :enabled, where(:provider_id => Provider.enabled)
+ scope :enabled, lambda { where(:provider_id => Provider.enabled) }
def validate_presence_of_credentials
provider.provider_type.credential_definitions.each do |cd|
ACK & Pushed