(Frenchy, sorry)
Hi everyone, i'm working on a web browser based game. I need to use
some postgresql special type such as point, path and line.
ActiveRecord caused me some troubles to migrate but now it's ok for
creating/migrating the database and querying the tables. BUT! Every
special type select are returned me as String...

To begin i tried to use a simple position "point" column. I tried some
few things like:

@first_character = Character.select("position[0] as x, position[1] as
y").first
@first_character.x returns me the good x value
@first_character.y return me a nil value...

OR:

@first_character = Character.select("position[1] as y, position[0] as
x").first
@first_character.y returns me the good y value
@first_character.x return me a nil value...

Why?!!

I know i should use an adapter, but: i really don't need PostGIS on my
database, i just use simples types and functions proposed by
postgresql native.

Regards.

--
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.

Search Discussions

  • Tim Shaffer at Sep 30, 2011 at 6:54 pm
    What data type is the position column in your database?

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/aj7wLKhPGKgJ.
    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.
  • Romain Maz BILLOIR at Oct 1, 2011 at 9:28 am
    position column is Point.

    For now i'm using a personnalized point class which i load into
    character model:
    composed_of :position, :class_name => "Point", :mapping => %w(position
    point)

    It work properly, but i'm affraid when i'll need to use some pgsql
    geometric functions/operator it return me errors...

    --
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedSep 27, '11 at 8:30p
activeOct 1, '11 at 9:28a
posts3
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Romain Maz BILLOIR: 2 posts Tim Shaffer: 1 post

People

Translate

site design / logo © 2022 Grokbase