bithavoc / multilang-hstore

Multilang is a small library for translating database values for Rails 4 and Postgresql hstore
MIT License
41 stars 18 forks source link

Compatability issue with Rails-4.0.0.rc2 #1

Closed mountriv99 closed 11 years ago

mountriv99 commented 11 years ago

The gem works great under Rails 4.0.0.rc1. For example:

Loading development environment (Rails 4.0.0.rc1)
irb(main):001:0> a = Announcement.first
  Announcement Load (3.1ms)  SELECT "announcements".* FROM "announcements" ORDER BY "announcements"."id" DESC LIMIT 1
=> #<Announcement id: 1, app_id: 1, title: {"en"=>"Title"}, message: {}, image: nil, link: nil, status: 0, created_at: "2013-06-25 03:44:19", updated_at: "2013-06-25 03:44:19">

But I'm getting the following error under Rails 4.0.0.rc2:

Loading development environment (Rails 4.0.0.rc2)
irb(main):001:0> a = Announcement.first
  Announcement Load (2.0ms)  SELECT "announcements".* FROM "announcements" ORDER BY "announcements"."id" DESC LIMIT 1
(Object doesn't support #inspect)
=> 
bithavoc commented 11 years ago

Hi @mountriv99

Thanks for your interested in the gem.

I'm still unable to reproduce this issue in rc4.

Johans-MacBook-Pro:testmult thepumpkin$ rails c
Loading development environment (Rails 4.0.0.rc2)
1.9.3p429 :001 > Post.create(title: {es: "Español", en: "English"})
   (0.1ms)  begin transaction
  SQL (8.2ms)  INSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?)  [["created_at", Tue, 25 Jun 2013 13:18:01 UTC +00:00], ["title", "\"es\"=>\"Español\",\"en\"=>\"English\""], ["updated_at", Tue, 25 Jun 2013 13:18:01 UTC +00:00]]
   (40.3ms)  commit transaction
 => #<Post id: 1, title: {"es"=>"Español", "en"=>"English"}, created_at: "2013-06-25 13:18:01", updated_at: "2013-06-25 13:18:01">
1.9.3p429 :002 > Post.first
  Post Load (0.3ms)  SELECT "posts".* FROM "posts" ORDER BY "posts"."id" ASC LIMIT 1
 => #<Post id: 1, title: {"es"=>"Español", "en"=>"English"}, created_at: "2013-06-25 13:18:01", updated_at: "2013-06-25 13:18:01">
1.9.3p429 :003 >

Can you show me the definition of your model Announcement?

Can the issue be related to these top results in google search?

Let me know.

mountriv99 commented 11 years ago

Hey @thepumpkin1979

I should thank you for the gem, it's amazing.

I'll show you the definition of another model "Location" coz it's simpler:

class Location < ActiveRecord::Base

    belongs_to :locatable, :polymorphic => true

    has_many :reservations, :dependent => :destroy

    multilang :name, :length => 50

    validates :locatable_type, :inclusion => {:in => %w(Brand LocationGroup)}
    validates :locatable_id, :presence => true

end

Its so simple I dont even know what could be wrong with it....

bithavoc commented 11 years ago

Well man, still unable to reproduce it.

Have you tried with the final Rails 4.0.0?

bithavoc commented 11 years ago

Just found a way to reproduce it. I'm investigating the issue :)

mountriv99 commented 11 years ago

Nope, just found out the final version is out, will give it a try later :D

how did u reproduce the error?

mountriv99 commented 11 years ago

same thing with Rails 4.0.0 final

bithavoc commented 11 years ago

Hi @mountriv99,

Yesterday I release the version 0.0.4 which is the final release the Rails 3 series.

In Rails 4, please try the version version 1.0.0.rc2.

gem 'multilang-hstore', '~> 1.0.0.rc2'

If it works for you with no issue then I will release the final version `1.0.0, which again, is for Rails 4 only.

In Rails 4 there is native support for hstore in activerecord 4.0.0 and above and the gem no longer requires engageis/activerecord-postgres-hstore, please remove it from your Gemfile too. I will update the Readme accordingly for the final Release.

Thanks for your collaboration, let me know your thoughts.

mountriv99 commented 11 years ago

looks good to me!

thanks again for the gem! :)