On Rails < 3 this patch results in: NameError: undefined method `scope' for class `Puppet::Rails::InventoryNode'
I've got a patch coming that works (should be mailed out by now), and passes tests (which it would be really good to run before emailing out patches http://projects.puppetlabs.com/projects/puppet/wiki/Development_Writing_Tests#Running+Tests) On Thu, Mar 24, 2011 at 11:31 AM, James Turnbull <ja...@lovedthanlost.net> wrote: > Added alias method for ActiveRecord versions before 3.0 > > Signed-off-by: James Turnbull <ja...@lovedthanlost.net> > --- > Local-branch: tickets/master/6818 > lib/puppet/rails/inventory_node.rb | 8 ++++++-- > 1 files changed, 6 insertions(+), 2 deletions(-) > > diff --git a/lib/puppet/rails/inventory_node.rb > b/lib/puppet/rails/inventory_node.rb > index 52f8621..9b5b790 100644 > --- a/lib/puppet/rails/inventory_node.rb > +++ b/lib/puppet/rails/inventory_node.rb > @@ -3,14 +3,18 @@ require 'puppet/rails/inventory_fact' > class Puppet::Rails::InventoryNode < ::ActiveRecord::Base > has_many :facts, :class_name => "Puppet::Rails::InventoryFact", > :foreign_key => :node_id, :dependent => :delete_all > > - named_scope :has_fact_with_value, lambda { |name,value| > + if Puppet::Util.activerecord_version < 3.0 > + alias :scope :named_scope > + end > + > + scope :has_fact_with_value, lambda { |name,value| > { > :conditions => ["inventory_facts.name = ? AND inventory_facts.value = > ?", name, value], > :joins => :facts > } > } > > - named_scope :has_fact_without_value, lambda { |name,value| > + scope :has_fact_without_value, lambda { |name,value| > { > :conditions => ["inventory_facts.name = ? AND inventory_facts.value != > ?", name, value], > :joins => :facts > -- > 1.7.1 > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Developers" group. > To post to this group, send email to puppet-dev@googlegroups.com. > To unsubscribe from this group, send email to > puppet-dev+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-dev?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to puppet-dev@googlegroups.com. To unsubscribe from this group, send email to puppet-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.