Marco Durden
2008-Sep-12 21:18 UTC
[Facebooker-talk] ArgumentError: Unknown key(s): dependant
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 :firstArgumentError: 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>
Mike Mangino
2008-Sep-12 22:44 UTC
[Facebooker-talk] ArgumentError: Unknown key(s): dependant
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
Maybe Matching Threads
- Problem with acts_as_paranoid: "ArgumentError: Unknown key(s): group"
- OS X - `require': no such file to load -- sqlite3/sqlite3_native
- Problem with rails generaterspec:install, Error-Message: no such file to load, sprockets-railtie (loadError)
- rspec failure upon revisit
- undefined method assert_valid_keys