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 the issue that the widget_id of the first widget intance bleeds into... #150

Open
wants to merge 4 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
12 changes: 8 additions & 4 deletions lib/apotomo/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ class Railtie < ::Rails::Railtie
load "apotomo/apotomo.rake"
end

# As we are a Railtie only, the routes won't be loaded automatically. Beside that, we want our
# route to be the very first (otherwise #resources might supersede it).
initializer 'apotomo.prepend_routes', :after => :add_routing_paths do |app|
app.routes_reloader.paths.unshift(File.dirname(__FILE__) + "/../../config/routes.rb")
# In Rails 5.1, a dynamic :controller segment in a route is deprecated.
# The routes for each controller have to be added in routes.rb.
if ::ActiveRecord.gem_version < ::Gem::Version.new("5.1.0.beta1")
# As we are a Railtie only, the routes won't be loaded automatically. Beside that, we want our
# route to be the very first (otherwise #resources might supersede it).
initializer 'apotomo.prepend_routes', :after => :add_routing_paths do |app|
app.routes_reloader.paths.unshift(File.dirname(__FILE__) + "/../../config/routes.rb")
end
end

# Include a lazy loader via has_widgets.
Expand Down
2 changes: 1 addition & 1 deletion lib/apotomo/widget/event_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module EventMethods
included do
after_initialize do
self.class.responds_to_event_options.each do |args|
type, options = args[0], args[1] || {}
type, options = args[0], (args[1] || {}).clone
target = self

if target_id = options[:passing]
Expand Down