[Facebooker-talk] ArgumentError: Unknown key(s): dependant

Marco Durden marcdurden at gmail.com
Fri Sep 12 17:18:02 EDT 2008


Hello,

I came across an association error today with facebooker.

class Cover < ActiveRecord::Base
  belongs_to :album
end

class Album < ActiveRecord::Base
  has_one :cover, :dependent => :destroy
end

At the console:

>> Album.find :first
ArgumentError: Unknown key(s): dependant
        from
/home/marc/rails_projects/project/vendor/plugins/facebooker/lib/facebooker/rails/helpers.rb:589:in
`assert_valid_keys'
        from
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/associations.rb:1187:in
`create_has_one_reflection'
        from
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/associations.rb:727:in
`has_one'
        from /home/marc/rails_projects/project/app/models/album.rb:2
        from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:203:in
`load_without_new_constant_marking'
        from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:203:in
`load_file'
        from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in
`new_constants_in'
        from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:202:in
`load_file'
        from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:94:in
`require_or_load'
        from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:248:in
`load_missing_constant'
        from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:453:in
`const_missing'
        from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:465:in
`const_missing'
        from (irb):1



So what I did, I went to line:586 of
vendor/plugins/facebooker/lib/facebooker/rails/helpers.rb:589:in
`assert_valid_keys'

585  # We can allow css attributes.
586  FB_ALWAYS_VALID_OPTION_KEYS = [:class, :style]

  and changed it to :

586  FB_ALWAYS_VALID_OPTION_KEYS = [:class, :style, :dependant]
587  def assert_valid_keys(*valid_keys)
588   unknown_keys = keys - [valid_keys +
FB_ALWAYS_VALID_OPTION_KEYS].flatten
589    raise(ArgumentError, "Unknown key(s): #{unknown_keys.join(", ")}")
unless unknown_keys.empty?
590  end


And now I no longer get the error.  If anyone has come across this error, or
if they know if this change will cause problems down the road, please let me
know.

Best
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/facebooker-talk/attachments/20080912/a790a4ad/attachment.html>


More information about the Facebooker-talk mailing list