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

fix: undefined method 'assets' for an instance #126

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/chosen-rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ module Rails
end

case ::Rails.version.to_s
when /^8/
require 'chosen-rails/engine8'
when /^(4|5|6|7)/
require 'chosen-rails/engine'
require 'chosen-rails/engine4'
when /^3\.[12]/
require 'chosen-rails/engine3'
when /^3\.[0]/
Expand Down
2 changes: 1 addition & 1 deletion lib/chosen-rails/engine.rb → lib/chosen-rails/engine4.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Chosen
module Rails
class Engine < ::Rails::Engine
class Engine4 < ::Rails::Engine
config.assets.precompile += %w(
chosen-sprite*.png
)
Expand Down
15 changes: 15 additions & 0 deletions lib/chosen-rails/engine8.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module Chosen
module Rails
class Engine8 < ::Rails::Engine
initializer 'chosen.assets.precompile' do |app|
app.config.assets.precompile += %w(
chosen-sprite*.png
)
end

rake_tasks do
load 'chosen-rails/tasks.rake'
end
end
end
end