Hi All,
I am totally new to Ruby and Ruby on Rails and thought I''d take it out
for a test drive. I am using postgresql as my database and am having
problems with a custom type created in postgresql.
CREATE TYPE uniqueidentifier (
INTERNALLENGTH = 16,
INPUT = uniqueidentifier_in,
OUTPUT = uniqueidentifier_out,
ALIGNMENT = int4,
STORAGE = plain
);
.......
CREATE CAST (public.uniqueidentifier AS text) WITH FUNCTION
public.text(public.u
niqueidentifier) AS IMPLICIT;
I have a "nodes" table that contains this custom type as some of
it''s
attributes.
CREATE TABLE nodes (
id uniqueidentifier NOT NULL,
...
name text NOT NULL,
...
);
when CRUDing this table the id attribute does not show up?
How can I support custom types?
Thanks in advance,
Byron
Byron Wright wrote:> I have a "nodes" table that contains this custom type as some of it''s > attributes.For what''s it''s worth, it''s == it is != its> CREATE TABLE nodes ( > id uniqueidentifier NOT NULL, > ... > name text NOT NULL, > ... > ); > > when CRUDing this table the id attribute does not show up? > > How can I support custom types?Right now, you will need to add your own support to the postgresql adapter. That is, you will need to extend the postgresql adapter. I would just define a new adapter based on postgresql to implement my own data types. Or you can modify rails to add support to your custom types. It is as simple as changing a few lines in abstract_adapter.rb and/or postgresql_adapter in vendor/activerecord/lib/active_record/connection_adapters - Adam