You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I try and find a model backed by a scenic mysql view and rails 7, I get the following error:
NoMethodError: undefined method `match' for nil:NilClass
from /home/rebecca/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-7.0.3/lib/active_record/connection_adapters/mysql/schema_statements
.rb:162:in `default_type'
I was able to fix it via adding the following monkey patch:
module ActiveRecord
module ConnectionAdapters
class AbstractMysqlAdapter < AbstractAdapter
def create_table_info(table_name) # :nodoc:
info = exec_query("SHOW CREATE TABLE #{quote_table_name(table_name)}", "SCHEMA").first
info["Create Table"] || info["Create View"]
end
end
end
end
All of the existing tests in the repo work with Rails 7. I tried to figure out how to add a test, that would catch this problem but I'm unsure how to do it.
The text was updated successfully, but these errors were encountered:
FYI but this is a bug in Rails 7.0.3. Not this adapter. See: rails/rails#45062 It's since been fixed and is in the 7-0-stable branch. I assume that 7.0.4 will fix it once released!
The text was updated successfully, but these errors were encountered: