instrumentl / rails-cloudflare-turnstile

ISC License
22 stars 9 forks source link

Rails doesn't have 'assets' #106

Open attenzione opened 10 months ago

attenzione commented 10 months ago

My Rails application doesn't compile assets at all, so configuration doesn't have an assets method (Sprockets not included in Rails)

jamesst20 commented 4 months ago

@Roguelazer

I second this, we use ruby-vite instead of Sprockets so as soon as we start the application, it crash with this exception

web    | /Users/james/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/railties-7.1.3.4/lib/rails/railtie/configuration.rb:109:in `method_missing': undefined method `assets' for an instance of Rails::Application::Configuration (NoMethodError)
web    | Did you mean?  asset_host
web    |    from /Users/james/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/rails_cloudflare_turnstile-0.2.1/lib/rails_cloudflare_turnstile/railtie.rb:12:in `block in <class:Railtie>'
web    |    from /Users/james/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/railties-7.1.3.4/lib/rails/initializable.rb:32:in `instance_exec'
web    |    from /Users/james/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/railties-7.1.3.4/lib/rails/initializable.rb:32:in `run'
web    |    from /Users/james/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/railties-7.1.3.4/lib/rails/initializable.rb:61:in `block in run_initializers'
web    |    from /Users/james/.rbenv/versions/3.3.2/lib/ruby/3.3.0/tsort.rb:231:in `block in tsort_each'
web    |    from /Users/james/.rbenv/versions/3.3.2/lib/ruby/3.3.0/tsort.rb:353:in `block (2 levels) in each_strongly_connected_component'
web    |    from /Users/james/.rbenv/versions/3.3.2/lib/ruby/3.3.0/tsort.rb:434:in `each_strongly_connected_component_from'
web    |    from /Users/james/.rbenv/versions/3.3.2/lib/ruby/3.3.0/tsort.rb:352:in `block in each_strongly_connected_component'
web    |    from /Users/james/.rbenv/versions/3.3.2/lib/ruby/3.3.0/tsort.rb:350:in `each'
web    |    from /Users/james/.rbenv/versions/3.3.2/lib/ruby/3.3.0/tsort.rb:350:in `call'
web    |    from /Users/james/.rbenv/versions/3.3.2/lib/ruby/3.3.0/tsort.rb:350:in `each_strongly_connected_component'
web    |    from /Users/james/.rbenv/versions/3.3.2/lib/ruby/3.3.0/tsort.rb:229:in `tsort_each'
web    |    from /Users/james/.rbenv/versions/3.3.2/lib/ruby/3.3.0/tsort.rb:208:in `tsort_each'
web    |    from /Users/james/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/railties-7.1.3.4/lib/rails/initializable.rb:60:in `run_initializers'
web    |    from /Users/james/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/railties-7.1.3.4/lib/rails/application.rb:426:in `initialize!'
web    |    from /Users/james/Projects/mcc/config/environment.rb:5:in `<main>'

Maybe adding in the gemspec as a dependency could resolve the error?

Edit: I commented out the line in engine.rb and railtie.rb to allow the server to boot and it seems to work fine too at least to have the cloudflare square tell me my domain is not valid in my form

Capture d’écran, le 2024-06-19 à 09 58 49

Capture d’écran, le 2024-06-19 à 09 58 58

so I would say either add sprocket-rails as a gem depedency and require it or check for respond_to assets