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

Mike Mangino mmangino at elevatedrails.com
Fri Sep 12 18:44:51 EDT 2008


Marco, check out the error message:

ArgumentError: Unknown key(s): *****dependant*****

It looks like this argument is spelled wrong in your model. I believe  
it is dependent with all Es.

Mike

On Sep 12, 2008, at 5:18 PM, Marco Durden wrote:

> 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
> _______________________________________________
> Facebooker-talk mailing list
> Facebooker-talk at rubyforge.org
> http://rubyforge.org/mailman/listinfo/facebooker-talk

--
Mike Mangino
http://www.elevatedrails.com





More information about the Facebooker-talk mailing list