Permalink
Switch branches/tags
Commits on Dec 12, 2017
  1. Merge pull request #70 from bonusly/fix-usage-without-activerecord

    rafaelfranca committed Dec 12, 2017
    Only require active_record/base if ActiveRecord defined
  2. Merge pull request #69 from bonusly/fix-usage-without-activerecord

    rafaelfranca committed Dec 12, 2017
    Ensure loading works without ActiveRecord
  3. Ensure loading works without ActiveRecord

    artfuldodger committed Dec 12, 2017
    Fixes `uninitialized constant ActiveRecord::Base::ConnectionHandling (NameError)` exception
Commits on Jul 16, 2017
  1. Remove old gemfiles from Travis.

    kaspth committed Jul 16, 2017
    Require Rails 4.2 to pass with Ruby 2.4.1 since it works
    in the last couple of builds.
  2. Remove Rails 4.0 and 4.1 support.

    kaspth committed Jul 16, 2017
    Bump version now so next version is guaranteed to have
    a bumped minor.
  3. v0.1.5.

    kaspth committed Jul 16, 2017
    * Fix observers not being instantiated on app boot.
    * Test with Rails 5.1 and the pending 5.2.
    
    NOTE: This is the last release to support Rails 4.0 and 4.1.
  4. Fix rails master gemfile.

    kaspth committed Jul 16, 2017
  5. Follow gemfile naming pattern.

    kaspth committed Jul 16, 2017
  6. Add back error route.

    kaspth committed Jul 16, 2017
  7. Revert "Skip needless Rails extension."

    kaspth committed Jul 16, 2017
    This reverts commit 4d3a671.
  8. Upgrade Rails test setup.

    kaspth committed Jul 16, 2017
    Default to Rails 5.1, bump 5.0 to a separate test file.
    
    Test with the latest Rails.
  9. Fix dynamic controller argument deprecation warning.

    kaspth committed Jul 16, 2017
    Be gone!
    
    ```
    DEPRECATION WARNING: Using a dynamic :controller segment in a route is deprecated and will be removed in Rails 5.2. (called from block in setup at /Users/kasperhansen/Documents/code/rails-observers/test/sweeper_test.rb:33)
    ```
  10. Merge pull request #63 from voxik/require-helper

    kaspth committed Jul 16, 2017
    Require helper to make Rails.version_matches? available.
  11. Merge pull request #64 from voxik/test-request-51

    kaspth committed Jul 16, 2017
    ActionControlle::TestRequest now have to reference controller class.
  12. Merge pull request #62 from voxik/am-test-case

    kaspth committed Jul 16, 2017
    Replace ActiveModel::TestCase with ActiveSupport::TestCase
  13. Merge pull request #65 from rails/fix-instantiating-observers-on-boot

    kaspth committed Jul 16, 2017
    Fix instantiating observers on app boot.
  14. Fix instantiating observers on app boot.

    kaspth committed Jul 16, 2017
    When adding support for Rails 4.1, 4.2 and 5.0, the `instantiate_observers`
    call that happened after boot was erroneously removed.
    https://github.com/rails/rails-observers/pull/39/files#diff-9db46e46113d0c2eeb41f5d6f08bcac4L24
    
    This covered a regression in the test suite for the rake integration and
    also broke the gem for apps.
    
    The reason the test/rake_test.rb failed was that a require to `active_record/base`
    had been removed which rails-observers depended on.
    rails/rails@9e9793b
    
    Without that we're this circular dependency error:
    
    ```
    kaspers-macbook-pro:observer kasperhansen$ cat Rakefile
    
    require_relative 'config/application'
    
    namespace :user do
      task :count => :environment do
        puts User.count
      end
    end
    
    Rails.application.load_tasks
    
    kaspers-macbook-pro:observer kasperhansen$ bin/rake user:count
    rake aborted!
    Circular dependency detected while autoloading constant User
    /Users/kasperhansen/Documents/code/rails-observers/lib/rails/observers/active_model/observing.rb:334:in `observed_class'
    /Users/kasperhansen/Documents/code/rails-observers/lib/rails/observers/active_model/observing.rb:325:in `observed_classes'
    /Users/kasperhansen/Documents/code/rails-observers/lib/rails/observers/active_model/observing.rb:345:in `observed_classes'
    /Users/kasperhansen/Documents/code/rails-observers/lib/rails/observers/activerecord/observer.rb💯in `observed_classes'
    /Users/kasperhansen/Documents/code/rails-observers/lib/rails/observers/active_model/observing.rb:341:in `initialize'
    /Users/kasperhansen/Documents/code/rails-observers/lib/rails/observers/active_model/observing.rb:186:in `instantiate_observer'
    /Users/kasperhansen/Documents/code/rails-observers/lib/rails/observers/active_model/observing.rb:108:in `block in instantiate_observers'
    /Users/kasperhansen/Documents/code/rails-observers/lib/rails/observers/active_model/observing.rb:108:in `each'
    /Users/kasperhansen/Documents/code/rails-observers/lib/rails/observers/active_model/observing.rb:108:in `instantiate_observers'
    /Users/kasperhansen/Documents/code/rails-observers/lib/rails/observers/railtie.rb:42:in `block (2 levels) in <class:Railtie>'
    /Users/kasperhansen/Documents/code/observer/app/models/application_record.rb:1:in `<top (required)>'
    /Users/kasperhansen/Documents/code/observer/app/models/user.rb:1:in `<top (required)>'
    /Users/kasperhansen/Documents/code/observer/Rakefile:8:in `block (2 levels) in <top (required)>'
    Tasks: TOP => user:count
    (See full trace by running task with --trace)
    ```
    
    That's because User loads ActiveRecord::Base which then instantiates
    the observers in its on_load hook, finally calling observed_class
    which constantizes the very User constant we're loading!
    
    One fix is to add a require to active_record/base manually here, because
    we depend on the load hooks having been fired before model constants are
    loaded.
    
    (I didn't look into reorganizing the code such that observed_class isn't
    needed on observer instantiation.)
    
    This has the added benefit of not breaking the gem should Rails remove
    the require's in `console` or `runner` blocks as well.
    
    I can reliably reproduce the above circular dependency error by commenting
    out the added `require "active_record/base"`. And when it's in the rake
    task works:
    
    ```
    kaspers-macbook-pro:observer kasperhansen$ bin/rake user:count
    1
    ```
Commits on Jul 7, 2017
  1. Require helper to make Rails.version_matches? available.

    voxik committed Jul 7, 2017
    Rails.version_matches? is used in this file.
  2. Replace ActiveModel::TestCase with ActiveSupport::TestCase

    voxik committed Jul 7, 2017
    ActiveModel::TestCase was removed in Rails 5.1 (#27928).
Commits on Jul 4, 2017
  1. Merge pull request #61 from voxik/fix-db-configuration-for-ror-51

    rafaelfranca committed Jul 4, 2017
    Make DB configuration compatilble with RoR 5.1.
  2. Make DB configuration RoR 5.1 compatible.

    voxik committed Jul 4, 2017
    The configuration does not accept symbols as a keys anymore, since
    rails/rails@0a4f600,
    so the keys has to be strings.
    
    Alternatively, HashWithIndiferentAccess could be used instead of plain
    Hash.
    
    However, it is not clear if this RoR change was intentional.
Commits on May 10, 2017
Commits on May 9, 2017
  1. Fix dependency fix

    dhh committed May 9, 2017
  2. Drop pessimistic upper-bounds entirely

    dhh committed May 9, 2017
    All pain, no gain.
Commits on Mar 31, 2017
  1. Merge pull request #57 from cle61/patch-1

    rafaelfranca committed Mar 31, 2017
    Update README.md
  2. Update README.md

    cle61 committed Mar 31, 2017
Commits on Mar 21, 2017
  1. Merge pull request #56 from brchristian/patch-1

    rafaelfranca committed Mar 21, 2017
    Ruby 1.9-style hashes in README