module Hobo::Model::Scopes::AutomaticScopes

Public Instance Methods

create_automatic_scope(name, check_only=false) click to toggle source
# File lib/hobo/model/scopes/automatic_scopes.rb, line 7
def create_automatic_scope(name, check_only=false)
  ScopeBuilder.new(self, name).create_scope(check_only)
rescue ActiveRecord::StatementInvalid => e
  # Problem with the database? Don't try to create automatic
  # scopes
  if ActiveRecord::Base.logger
    ActiveRecord::Base.logger.warn "!! Database exception during hobo auto-scope creation -- continuing automatic scopes"
    ActiveRecord::Base.logger.warn "!! #{e.to_s}"
  end
  false
end