-
Notifications
You must be signed in to change notification settings - Fork 8
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
Rails 5 #5
Rails 5 #5
Conversation
This change makes the code Rails5 compatible only, as on earlier versions I would create a singleton method in the wdyt? |
target.superclass | ||
else | ||
target | ||
end |
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.
Do we even need this here. At this point we already know we are plugging into ActiveRecord, so why can't we just use ActiveRecord::Base directly?
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.
Good point. Nuke it :-)
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.
Thanks for untangling the mess :-)
Under the hood it works the same as passing nil to quote_value in Rails 4+, and is deprecated in Rails 5.
if target.respond_to?(:base_class) | ||
target.base_class.superclass # Active Record | ||
if defined?(ActiveRecord::Base) && target.ancestors.include?(ActiveRecord::Base) | ||
ActiveRecord::Base |
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.
V2. Let Ruby do the hard work.
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.
👍
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.
Poor wording in the message, quote_value
is deprecated in Rails 5.
@@ -40,7 +40,6 @@ def initialize | |||
run_specs | |||
run_cucumber | |||
report_coverage | |||
generate_documentation |
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.
Why?
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.
Per the commit message, for some reason this task fails on Travis. Works fine locally, so
¯\_(ツ)_/¯
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.
OK, I have added #6 asking for a revert, with some details that'll aid investigation.
@@ -25,7 +25,7 @@ module PostgresJSONb | |||
def accessible_by(actor) | |||
return scoped if actor.is_admin? | |||
|
|||
designators = actor.designators.map {|d| quote_value(d, nil) } | |||
designators = actor.designators.map {|d| sanitize(d) } |
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.
As long as it works on older Rails it's OK with me.
When Travis gets around to testing, it should all be green now. Note that there is a deprecation warning: DEPRECATION WARNING: before_filter is deprecated and will be removed in Rails 5.1. Use before_action instead. (called from authorize at eaco/lib/eaco/controller.rb:57) I'd suggest in the next version we drop support for Rails 3.2 (and maybe Ruby 2.1?) and switch everything to |
Thanks @lucaspiller. Noted the deprecation warning, and mildly agree on dropping Rails 3.2. I would support it the longest we can. |
All green! The coverage decrease is due to the conditional for the API change in a support file, not sure why it's included in the report: |
@vjt Good to merge? |
A |
Its in a support file for specs, is there a way to exclude it? On 23 Sep 2016, 09:59 +0200, Marcello Barnaba notifications@github.com, wrote:
|
1 similar comment
💯 % coverage! @vjt Good to merge? |
Thanks. Please go on. ~Marcello~ vjt@openssl.it
|
Adds support for Rails 5. The only thing needing to be changed is support for the ApplicationRecord base class for models:
http://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#active-record-models-now-inherit-from-applicationrecord-by-default
I'm open for suggestions to make the code less nasty :D