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
from :0
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!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---