Getting "undefined method `macro'" for different classes

I am not sure what is causing this. As mentioned I am getting the same
error from different classes and no where do I have a custom macro
method.

I have reset the server a few times, but I still get the same thing.
The code running on the live server works fine. Although I have made
some changes, none of them are related to data access.

Any ideas?

I am not sure what is causing this. As mentioned I am getting the
same
error from different classes and no where do I have a custom macro
method.

I have reset the server a few times, but I still get the same thing.
The code running on the live server works fine. Although I have made
some changes, none of them are related to data access.

Any ideas?

What's in your models ? I'd guess that you've accidentally overwritten
an activerecord method,

Fred

What’s in your models ? I’d guess that you’ve accidentally overwritten

an activerecord method,

Particularly in the Season model and its method create_games
as indicated at the bottom of the errors:

shouldnt it be

:conditions => ["season_id = ?", id]

or

:conditions => {:season_id => self},

instead of

:conditions => "season_id =#{self.id}",

Chris Olsen wrote:

shouldnt it be

:conditions => ["season_id = ?", id]

or

:conditions => {:season_id => self},

instead of

:conditions => "season_id =#{self.id}",

All three will work. the latter opens a window for injection nastiness.

Fred

Thx Fred!

Franz Strebel wrote:

What's in your models ? I'd guess that you've accidentally overwritten
an activerecord method,

Particularly in the Season model and its method create_games
as indicated at the bottom of the errors:

It turns out the error is in a couple of custom method I added to the
Array class, although I am not sure where the overlap is.

These are the methods I added to lib/array.rb.

class Array
  def group
    groups = {}
    self.each do |item|
      groups[item] ||= []
      groups[item] << item
    end
    groups
  end

  def group_by(&block)
    groups = {}
    self.each do |item|
      val = yield(item)
      groups[item] ||= []
      groups[item] << val
    end
    groups
  end
end

Franz Strebel wrote:

What's in your models ? I'd guess that you've accidentally
overwritten
an activerecord method,

Particularly in the Season model and its method create_games
as indicated at the bottom of the errors:

It turns out the error is in a couple of custom method I added to the
Array class, although I am not sure where the overlap is.

These are the methods I added to lib/array.rb.

There is already a method group_by in rails, you've overwritten it
with one which different meaning

rails: >> [1,2,3,'Foo', 'Boo'].group_by {|r| r.class}
=> [[Fixnum, [1, 2, 3]], [String, ["Foo", "Boo"]]]

you:

[1,2,3,'Foo', 'Boo'].group_by {|r| r.class}
=> {"Boo"=>[String], 1=>[Fixnum], 2=>[Fixnum], "Foo"=>[String],
3=>[Fixnum]}

which doesn't seem to be doing anything useful, at least not in the
way rails uses it

Fred

Thanks for the help Fred.