Has anyone else had problems with this scenario?
class Team < ActiveRecord::Base # Primary key self.primary_key = 'team_id'
has_many :players, :foreign_key => :team_id
has_permalink :city, :param => true end
I am getting all kinds of trouble - that goes away if I comment out the has_permalink declaration.
With PermalinkFu:
fs = Team.new
=> #<Team team_id: nil, abbr: nil, city: nil, created_at: nil, updated_at: nil, permalink: nil>
fs.team_id = 1
NoMethodError: undefined method `team_id=' for #<Team:0x2af1173c6030> from ~/20080917172814/vendor/rails/activerecord/lib/active_record/ attribute_methods.rb:251:in `method_missing' from (irb):8
without it just assigns the correct value to team_id
The real bizarness comes here:
fs.id = 1
=> 1
fs
=> #<Team team_id: 1, abbr: nil, city: nil, created_at: nil, updated_at: nil, permalink: nil>
How does this happen?
This is all well and good except that these things fail:
record = Team.find_or_create_by_team_id(1)
NoMethodError: undefined method `team_id=' for #<Team:0x2af1173b2418>
Help!