Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

rails-footnotes breaks Rails 4 application on boot #90

Closed
wants to merge 8 commits into from

6 participants

@rrooding

It seems the implementation of ActiveSupport::LogSubscriber has changed and at the very least you need to call super now when subclassing it. If you dont do this, the following error appears on trying to start the app:

ActiveRecord::StatementInvalid in DashboardController#index
TypeError: nil is not a symbol: SHOW FULL FIELDS FROM `subdomains`

This pull request only fixes the breakage on rails 4, but there are some other things not working as they should because the DB and Queries notes are not showing up in the footer.

For more information, also see rails/rails#9433

@codeodor codeodor referenced this pull request in rrooding/rails-footnotes
Merged

Finish off the fixes for Rails 4 #1

@codeodor

To keep @josevalim up to date, I've submitted a pull request to @rrooding which finishes off the Rails 4 support and removes all the deprecated notices.

When merged there, I think its commits should be reflected in this PR as well, which means rails-footnotes is ready for Rails 4 (as tested against beta 1).

It will fix #91 as a side effect.

@Intrepidd
Collaborator

Bump ! Any love for this PR? :heart:

@Intrepidd
Collaborator

Hey guys it's me again. I'm maintaining this repo now, and since I'm using this gem with rails 4 nearly every day, I think this issue is closed (using the git version)

New version coming soon !

@Intrepidd Intrepidd closed this
@codeodor

Awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
2  Rakefile
@@ -1,7 +1,7 @@
require 'bundler'
Bundler::GemHelper.install_tasks
require "rspec/core/rake_task"
-require 'rake/rdoctask'
+require 'rdoc/task'
desc 'Default: run tests'
task :default => :spec
View
2  lib/rails-footnotes/after_filter.rb
@@ -1,7 +1,7 @@
module Footnotes
class AfterFilter
# Method that calls Footnotes to attach its contents
- def self.filter(controller)
+ def self.after(controller)
filter = Footnotes::Filter.new(controller)
filter.add_footnotes!
filter.close!(controller)
View
2  lib/rails-footnotes/before_filter.rb
@@ -2,7 +2,7 @@ module Footnotes
class BeforeFilter
# Method called to start the notes
# It's a before filter prepend in the controller
- def self.filter(controller)
+ def self.before(controller)
Footnotes::Filter.start!(controller)
end
end
View
1  lib/rails-footnotes/notes/queries_note.rb
@@ -96,6 +96,7 @@ class QuerySubscriber < ActiveSupport::LogSubscriber
attr_accessor :events, :ignore_regexps
def initialize(orm)
+ super()
@events = []
orm.each {|adapter| ActiveSupport::LogSubscriber.attach_to adapter, self}
end
View
12 lib/rails-footnotes/notes/routes_note.rb
@@ -46,9 +46,15 @@ module Routes
#
def filtered_routes(filter = {})
return [] unless filter.is_a?(Hash)
+ diff = ->(left, right){
+ left.dup.
+ delete_if { |k, v| right[k] == v }.
+ merge!(right.dup.delete_if { |k, v| left.has_key?(k) })
+ }
+
return routes.reject do |r|
- filter_diff = filter.diff(r.requirements)
- route_diff = r.requirements.diff(filter)
+ filter_diff = diff.call(filter, r.requirements)
+ route_diff = diff.call(r.requirements, filter)
(filter_diff == filter) || (filter_diff != route_diff)
end
end
@@ -57,5 +63,5 @@ def filtered_routes(filter = {})
end
if Footnotes::Notes::RoutesNote.included?
- ActionController::Routing::RouteSet.send :include, Footnotes::Extensions::Routes
+ ActionDispatch::Routing::RouteSet.send :include, Footnotes::Extensions::Routes
end
View
1  spec/spec_helper.rb
@@ -10,6 +10,7 @@
require 'active_support'
require 'active_support/all' unless Class.respond_to?(:cattr_accessor)
+require 'active_support/core_ext' unless Module.respond_to?(:mattr_accessor)
require 'rails-footnotes/footnotes'
require 'rails-footnotes/abstract_note'
require "rails-footnotes"
Something went wrong with that request. Please try again.