Thanks a lot Alexey, very helpful! I've opened a bug but I'm not sure if it is rails or sqlite3 related:
https://github.com/rails/rails/issues/2743 so I also opened it in sqlite3: https://github.com/luislavena/sqlite3-ruby/issues/48 On 30 Aug., 11:49, Alexey Muranov <[email protected]> wrote: > I confirm that there is a problem. > This is with Rails 3.1.0rc8 > > $ rails new test_ip > $ cd test_ip > $ rails generate model MyModel ip:string description:string > $ rake db:migrate > $ rails generate controller Writer write_records > > app/controllers/writer_controller.rb: > > class WriterController < ApplicationController > def write_records > MyModel.create!(:ip =>request.remote_ip, :description => 'request') > MyModel.create!(:ip => '127.0.0.1', :description => 'string') > end > end > > $ rails s > > go tohttp://localhost:3000/writer/write_records > > $ rails c > > > MyModel.all > > MyModel Load (0.2ms) SELECT "my_models".* FROM "my_models" > => [#<MyModel id: 1, ip: "127.0.0.1", description: "request", > created_at: "2011-08-30 09:42:09", updated_at: "2011-08-30 09:42:09">, > #<MyModel id: 2, ip: "127.0.0.1", description: "string", created_at: > "2011-08-30 09:42:09", updated_at: "2011-08-30 09:42:09">] > > > MyModel.where(:ip => '127.0.0.1').all > > MyModel Load (0.2ms) SELECT "my_models".* FROM "my_models" WHERE > "my_models"."ip" = '127.0.0.1' > => [#<MyModel id: 2, ip: "127.0.0.1", description: "string", > created_at: "2011-08-30 09:42:09", updated_at: "2011-08-30 09:42:09">] > > > MyModel.first.ip == '127.0.0.1' > > MyModel Load (0.2ms) SELECT "my_models".* FROM "my_models" LIMIT 1 > => true > > In the database for the first ip i have: X'3132372E302E302E31' > > -- > Posted viahttp://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

