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

NoMethodError: undefined method `table_name' with Rails 7.1.0 #1444

Closed
wrburgess opened this issue Oct 9, 2023 · 3 comments
Closed

NoMethodError: undefined method `table_name' with Rails 7.1.0 #1444

wrburgess opened this issue Oct 9, 2023 · 3 comments

Comments

@wrburgess
Copy link

wrburgess commented Oct 9, 2023

Recently upgraded a rails application from 7.0.8 to 7.1.0, using ruby 3.2.2

Search using ransack returns this error:

NoMethodError: undefined method `table_name' for #<Arel::Table:0x00007f62299aa050 @name="titles",

return nil unless attr && attr.valid?
--
15 | name         = attr.arel_attribute.name.to_s
16 | table        = attr.arel_attribute.relation.table_name
17 | schema_cache = self.klass.connection.schema_cache
18 | unless schema_cache.send(:data_source_exists?, table)

Reverting back to rails 7.0.8 corrects the issue

@OutlawAndy
Copy link

I just hit this also. Not sure what happened to Arel::Table#table_name but changing line 16 to table = attr.arel_attribute.relation.name resolves the issue.

Is there a pattern in place already for handling API changes between Rails versions? I'd be happy to put together a PR with a little guidance from someone more familiar with the project. Thanks.

@dmitrue
Copy link

dmitrue commented Oct 10, 2023

temporary solution mentioned here #1420

@deivid-rodriguez
Copy link
Contributor

Closed by #1439.

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

No branches or pull requests

4 participants