Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception: comparison of Symbol with String failed #66

Closed
RST-J opened this issue Oct 30, 2015 · 3 comments
Closed

Exception: comparison of Symbol with String failed #66

RST-J opened this issue Oct 30, 2015 · 3 comments
Labels

Comments

@RST-J
Copy link

RST-J commented Oct 30, 2015

In some class I have an HABTM association defined where the foreign key is given as symbol which leads to the exception in the title. Changing the symbol to a string fixes this issue, so there probably is some to_s missing somewhere.

has_and_belongs_to_many :teams, association_foreign_key: :circle_id is bad
has_and_belongs_to_many :teams, association_foreign_key: 'circle_id' is fine

@plentz
Copy link
Owner

plentz commented Oct 31, 2015

@RST-J can you paste the exception that's being thrown? :)

@RST-J
Copy link
Author

RST-J commented Nov 2, 2015

Class: Partnership
Association type: has_and_belongs_to_many
Association options: {:association_foreign_key=>:circle_id, :join_table=>"partnerships_teams"}
Exception: comparison of Symbol with String failed
/home/jonas/.rvm/gems/ruby-2.2.3/gems/lol_dba-2.0.1/lib/lol_dba.rb:115:in `sort'
/home/jonas/.rvm/gems/ruby-2.2.3/gems/lol_dba-2.0.1/lib/lol_dba.rb:115:in `block (2 levels) in check_for_indexes'
/home/jonas/.rvm/gems/ruby-2.2.3/gems/lol_dba-2.0.1/lib/lol_dba.rb:92:in `each_pair'
/home/jonas/.rvm/gems/ruby-2.2.3/gems/lol_dba-2.0.1/lib/lol_dba.rb:92:in `block in check_for_indexes'
/home/jonas/.rvm/gems/ruby-2.2.3/gems/lol_dba-2.0.1/lib/lol_dba.rb:86:in `each'
/home/jonas/.rvm/gems/ruby-2.2.3/gems/lol_dba-2.0.1/lib/lol_dba.rb:86:in `check_for_indexes'
/home/jonas/.rvm/gems/ruby-2.2.3/gems/lol_dba-2.0.1/lib/lol_dba.rb:179:in `simple_migration'
/home/jonas/.rvm/gems/ruby-2.2.3/gems/lol_dba-2.0.1/lib/lol_dba/cli.rb:29:in `start'
/home/jonas/.rvm/gems/ruby-2.2.3/gems/lol_dba-2.0.1/lib/lol_dba/cli.rb:17:in `start'
/home/jonas/.rvm/gems/ruby-2.2.3/gems/lol_dba-2.0.1/bin/lol_dba:10:in `<top (required)>'
/home/jonas/.rvm/gems/ruby-2.2.3/bin/lol_dba:23:in `load'
/home/jonas/.rvm/gems/ruby-2.2.3/bin/lol_dba:23:in `<main>'
/home/jonas/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `eval'
/home/jonas/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `<main>'

@plentz
Copy link
Owner

plentz commented Jan 9, 2016

@RST-J I've just released 2.0.3 that should fix this problem :)

thanks for the report :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants