-
Notifications
You must be signed in to change notification settings - Fork 28
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
Merge measured-rails
into this gem
#155
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good!
The README needs to be updated to include all the stuff in the measured-rails
about how to use the Rails stuff. It can mostly just be copied over and put into another top level heading.
It'll mean a major version bump of this gem, and then measured-rails
should have a post install message that says it does nothing and then make the gem an empty shell, and a README that just points to this repo, and then release them both to a major version at the same time. Then just stop supporting the old one.
I think that will work? If someone just says gem "measured-rails"
in their project it will update to the new major version then it will not work at all, and they can see the post install message and just change it to gem "measured"
. Shouldn't be dangerous, should it?
Thanks for doing this. It simplifies it quite a bit.
|
||
::ActiveRecord::Base.include( | ||
Measured::Rails::ActiveRecord, | ||
Measured::Rails::ActiveRecord::Length, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was like this before, but I think we can lazy load these. I'll make a note to look at this later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I am doing a more or less straight port for now, and trying to not do any incidental changes.
It would definitely be great if we can do the lazy loading.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's how measured
works, or at least optionally. But seeing this in one place makes me realize that we don't allow that if you're using measured-rails
. I'll put it on my backlog.
class Rails < ::Rails::Railtie | ||
class Error < StandardError ; end | ||
|
||
ActiveSupport.on_load(:active_record) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This plugin is also designed to work on an ActiveModel::Model
. Though apparently it isn't tested.
I merged the |
53e5807
to
448bd1b
Compare
@@ -269,7 +379,7 @@ Existing alternatives which were considered: | |||
* **Cons** | |||
* Opens up and modifies `Array`, `Date`, `Fixnum`, `Math`, `Numeric`, `String`, `Time`, and `Object`, then depends on those changes internally. | |||
* Lots of code to solve a relatively simple problem. | |||
* No ActiveRecord adapter. | |||
* No Active Record adapter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😬
measured-rails
into this gem
This is an initial attempt at reducing the support burden of having 2 separate gems for
measured
behaviour, when we can easily have a single gem that (conditionally) loads aRailtie
which does all Active Record registrations.This allows the gem to work as a simple Ruby gem, as well as a Rails extension.
This PR copies all of the current behaviour of
measured-rails
into this gem and makes it load whenActiveRecord
is loaded.