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

update to activesupport 4.2 #94

Merged
merged 1 commit into from
Feb 2, 2015
Merged

Conversation

Ch4s3
Copy link
Contributor

@Ch4s3 Ch4s3 commented Dec 22, 2014

No description provided.

@Ch4s3
Copy link
Contributor Author

Ch4s3 commented Dec 22, 2014

There's an issue with MysqlAesNew search on 4.2. It might be related to changes in scope, but I'm not sure. I'll investigate.

@Ch4s3
Copy link
Contributor Author

Ch4s3 commented Dec 23, 2014

Should be good now, I switched the MysqlAesNew search to a select.

@Ch4s3 Ch4s3 mentioned this pull request Dec 23, 2014
@@ -36,7 +36,7 @@ def decrypt(value)
#
# Returns an Enumerable
def search(records, field, criteria)
records.where(field.to_sym => encrypt(criteria))
records.select { |record| record[field] == criteria }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change requires every single record in the table to be loaded by active record, which isn't ideal. Any idea on the root cause?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The query builder has changed a bit in 4.2, and .where(field.to_sym => encrypt(criteria)) doesn't get turned into the same query as it did in 4.1.x. The tests are passing around an array of classes and not specifically an AR collection, so it may behave differently.

I tried a variety of queries and the select is the only one that seems to pass. Any ideas @jmazzi? I'm happy to keep hacking at it.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ch4s3#1 fixes the issue

@mhenrixon
Copy link

👍

@Ch4s3
Copy link
Contributor Author

Ch4s3 commented Dec 28, 2014

Can anyone figure out a better way to write this line?

@stve
Copy link

stve commented Jan 20, 2015

any progress on this fellas? In the process of upgrading an app and just realized this is a blocker for me. Thanks.

@Ch4s3
Copy link
Contributor Author

Ch4s3 commented Jan 20, 2015

@stve It's a blocker for my team as well, but I/we haven't had time to figure it out yet. The only issue is the Mysql aes search discussed above. If you have any thoughts, we can probably get it knocked out soon. (As long as the problem isn't with ActiveRecord or the query builder)

@dwilkie
Copy link

dwilkie commented Jan 28, 2015

Ch4s3#1

@teampayoff
Copy link

I took a look at this and it seems that the encryption is executed automatically by ActiveRelation when it is constructing the query. Dumping out the SQL generated seemed to confirm this. The following should work fine:

       def search(records, field, criteria)
         records.where(field.to_sym => criteria)

@Ch4s3
Copy link
Contributor Author

Ch4s3 commented Jan 28, 2015

@jmazzi It looks like @dwilkie sorted out the MySql issue. It should be ready to go now.

@jmazzi
Copy link
Owner

jmazzi commented Jan 28, 2015

@Ch4s3 @dwilkie awesome, did you want to open up a PR?

@Ch4s3
Copy link
Contributor Author

Ch4s3 commented Jan 28, 2015

@jmazzi This ( #94 ) is the pull request for the update. I merged @dwilkie 's into support_rails_4_2 branch on Ch4s3/crypt_keeper.

@jmazzi
Copy link
Owner

jmazzi commented Feb 2, 2015

@Ch4s3 nice! can you squash it into one commit and document the change? I will release it right after merging.

@Ch4s3 Ch4s3 force-pushed the support_rails_4_2 branch from 8cbfebb to 9b0b8f9 Compare February 2, 2015 17:58
@Ch4s3 Ch4s3 force-pushed the support_rails_4_2 branch from 9b0b8f9 to 3f3c803 Compare February 2, 2015 18:30
@Ch4s3
Copy link
Contributor Author

Ch4s3 commented Feb 2, 2015

@jmazzi Its squashed and I added a bit to the Readme that says tested against 4.2, I wasn't sure what/where else to document the changes. I also added MRI 2.2 to the travis matrix for AR 4.2, since I feel like most people using 4.2 will want to use 2.2.

gem.add_runtime_dependency 'activerecord', '>= 3.1', '< 4.2'
gem.add_runtime_dependency 'activesupport', '>= 3.1', '< 4.2'
gem.add_runtime_dependency 'activerecord', '>= 3.1', '<= 4.2'
gem.add_runtime_dependency 'activesupport', '>= 3.1', '<= 4.2'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ch4s3 is there a specific reason you went with <= over < 4.3? If not, I'm going to change that in master after merging.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No specific reason, but I'm not sure if 4.3 will be a thing or if they're jumping straight to 5.0, I haven't been following AR/Rails too closely lately.

jmazzi added a commit that referenced this pull request Feb 2, 2015
@jmazzi jmazzi merged commit 07cc3da into jmazzi:master Feb 2, 2015
@jmazzi
Copy link
Owner

jmazzi commented Feb 2, 2015

This fix was released as 0.19.0

On Feb 2, 2015, at 3:11 PM, Chase Gilliam notifications@github.com wrote:

@jmazzi https://github.com/jmazzi Its squashed and I added a bit to the Readme that says tested against 4.2, I wasn't sure what/where else to document the changes. I also added MRI 2.2 to the travis matrix for AR 4.2, since I feel like most people using 4.2 will want to use 2.2.


Reply to this email directly or view it on GitHub #94 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants