Ruby on Rails Monday, August 29, 2011

how can I get more details about the encoding/chars in the dbconsole?

sqlite> select name from doc_types;
127.0.0.1
127.0.0.1


On 29 Aug., 20:02, Frederick Cheung <frederick.che...@gmail.com>
wrote:
> On Aug 29, 6:34 pm, sol <ch.bl...@gmail.com> wrote:> This is really weird, either a bug (it's 3.1 rc5) or I don't know:
>
> > 1) DocType.create(:name =>request.remote_ip)
> >   DocType.find_by_name('127.0.0.1')
> >   DocType Load (1.4ms)  SELECT "doc_types".* FROM "doc_types" WHERE
> > "doc_types"."name" = '127.0.0.1' LIMIT 1
> >  => nil
>
> So what's actually in the database in that case? Any unexpected
> characters (new lines etc.) ?
>
> Fred
>
>
>
>
>
>
>
> > DocType.create(:name => "127.0.0.1")
> >   DocType.find_by_name('127.0.0.1')
> >   DocType Load (1.4ms)  SELECT "doc_types".* FROM "doc_types" WHERE
> > "doc_types"."name" = '127.0.0.1' LIMIT 1
> >  => #<DocType id: 3, name: "127.0.0.1", description: nil>
>
> > On 29 Aug., 18:04, sol <ch.bl...@gmail.com> wrote:
>
> > > Hey, I have the following line in my controller:
>
> > > User.create(:email => "f...@bar.com", :password =>
> > > 'asldfkjadsfadsf', :ip =>request.remote_ip)
>
> > > my IP is 127.0.0.1 - now User.find_by_ip('127.0.0.1') returns 0
> > > records although User.first contains '127.0.0.1'
>
> > > if I change it to:
>
> > > User.create(:email => "f...@bar.com", :password =>
> > > 'asldfkjadsfadsf', :ip => '127.0.0.1')
> > > the finder returns the record
>
> > > The model is a devise model, ip is attr_accessible
> > > Can anyone please help me getting out of this confusion? I don't
> > > understand it

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment