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

Doesn't work with Rails 7 #13

Open
rmeritz opened this issue May 18, 2022 · 1 comment
Open

Doesn't work with Rails 7 #13

rmeritz opened this issue May 18, 2022 · 1 comment

Comments

@rmeritz
Copy link

rmeritz commented May 18, 2022

  • 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.
@andrewmarkle
Copy link

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!

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

2 participants