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

wrong table name. bug introduced in my last PR #55

Closed
burnt43 opened this issue Sep 21, 2015 · 1 comment · Fixed by #56
Closed

wrong table name. bug introduced in my last PR #55

burnt43 opened this issue Sep 21, 2015 · 1 comment · Fixed by #56

Comments

@burnt43
Copy link
Contributor

burnt43 commented Sep 21, 2015

My code changes the table_name class variable of an ActiveRecord::Base, auto_upgrade! was likely to fail if you have a has_and_belongs_to_many. This is because I was using gsub! on table_name itself and not a clone of the table names in my calculating the join table name.

Basically the situation is like the following:

Before:
SchoolTeacher.table_name is 'school_teachers'
SchoolStudent.table_name is 'school_students'.

The code I added would make the join table 'school_students_teachers' like Rails 4 expects. However, afterwards there is an unintended consequence.

After:
SchoolTeacher.table_name is 'teachers' NOT GOOD!!!
SchoolStudent.table_name is 'school_students'.

See PR #54
See commit fc4ccf5

I have a fix for this!

@burnt43
Copy link
Contributor Author

burnt43 commented Sep 21, 2015

I fixed this in #56

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

Successfully merging a pull request may close this issue.

1 participant