madeintandem / hstore_accessor

Adds typed hstore-backed field support to ActiveRecord models.
MIT License
242 stars 47 forks source link

Rails 5 issue with boolean type #69

Closed marcusg closed 7 years ago

marcusg commented 8 years ago

I've got an error when using the boolean typecast within Rails 5.0.0.beta3. All other types (string, datetime) work very well.

NoMethodError: undefined method `type_cast_from_user' for #<ActiveModel::Type::Boolean:0x007fc070def5c0>
    from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/hstore_accessor-1.0.3/lib/hstore_accessor/active_record_4.2/type_helpers.rb:27:in `cast'
    from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/hstore_accessor-1.0.3/lib/hstore_accessor/serialization.rb:26:in `block in <module:Serialization>'
    from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/hstore_accessor-1.0.3/lib/hstore_accessor/serialization.rb:45:in `deserialize'
    from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/hstore_accessor-1.0.3/lib/hstore_accessor/macro.rb:76:in `block (3 levels) in hstore_accessor'
    from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/hstore_accessor-1.0.3/lib/hstore_accessor/macro.rb:80:in `block (3 levels) in hstore_accessor'
    from (irb):7
    from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.0.beta3/lib/rails/commands/console.rb:65:in `start'
    from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.0.beta3/lib/rails/commands/console_helper.rb:9:in `start'
    from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.0.beta3/lib/rails/commands/commands_tasks.rb:78:in `console'
    from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.0.beta3/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
    from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.0.beta3/lib/rails/command.rb:20:in `run'
    from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.0.beta3/lib/rails/commands.rb:18:in `<top (required)>'
    from bin/rails:9:in `require'
    from bin/rails:9:in `<main>'

Thanks!

ryanclark2 commented 8 years ago

Hey @marcusg There are a number of changes to ActiveRecord for Rails 5.0. We're working on getting something cooked up. In the meantime, use at your own risk.

jeffblake commented 7 years ago

Would love to see this gem become rails 5 compatible. It's the last gem on my list :)

g3ortega commented 7 years ago

I have the same problem! Any update?

jhirn commented 7 years ago

We released a beta 1.0 branch which Rails 5 compatibility a couple weeks ago. Please check it it out. We'd love you feedback.

On Nov 22, 2016, at 7:24 AM, Gerardo Ortega notifications@github.com wrote:

I have the same problem! Any update?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

g3ortega commented 7 years ago

Hi @jhirn, I already tried it, but I had the same issue, then I tried using the fork of @hanselmw, and It's working well

jhirn commented 7 years ago

Ah I'm sorry I answered this early in the morning and realize this is for hstore_accessor. We've paid much attention to this gem since we're mostly using jsonb_accessor these days.

I'll take a look at the pull request from @hanselmw soon and get it merged in if all looks well.

On Tue, Nov 22, 2016 at 11:22 AM, Gerardo Ortega notifications@github.com wrote:

Hi @jhirn https://github.com/jhirn, I already tried it, but I had the same issue, then I tried using the fork of @hanselmw https://github.com/hanselmw, and It's working well

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/devmynd/hstore_accessor/issues/69#issuecomment-262305756, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKMsRW24blwNc2zPHTYJFev4NimnoVIks5rAyTvgaJpZM4IJqSA .

jeffblake commented 7 years ago

Hi, it would be wonderful to see an update to support Rails 5. Love this gem.

jeffblake commented 7 years ago

Bump. Please :)

iain commented 7 years ago

That PR seems to work. Please merge and release a new version. Thanks

ian commented 7 years ago

@jhirn any timeframe on landing that PR?

crismali commented 7 years ago

v1.1 was just released. All of the tests pass against ActiveRecord 5.0 and 5.1.