Hi I have a problem accessing an array field in a Postgresql database.
Here is the table definition.
View "neil.flashing_codes"
Column | Type | Modifiers
-------------±----------------------±----------
code | character varying(10) |
description | text |
folds | integer[] |
View definition:
SELECT flashings.code, max(flashings.description::text) AS
description, array_accum(flashings.folds) AS folds
FROM flashings
GROUP BY flashings.code;
Here is a sample of the records.
select * from flashing_codes limit 10;
code | description | folds
----------±-----------------------------------------±--------------------
SG.05A | ALUMINIUM FLASHING C/B GIRTH 520MM FOLDS | {1,0,2,3,4,5,6}
DN.03Z | .6MM FLASHING Z/A GIRTH 200MM FOLDS | {0,6,5,4,3,2,1}
SR.05G | .6MM FLASHING GAL GIRTH 300MM FOLDS | {5,4,3,2,1,0,6}
RR.06Z | .6MM FLASHING Z/A GIRTH 400MM FOLDS | {6,5,4,3,2,1,0}
RR.05G | .6MM FLASHING GAL GIRTH 300MM FOLDS | {6,5,4,3,2,1,0}
RR.09C | .6MM FLASHING C/B GIRTH 600MM FOLDS | {6,5,4,3,2,1,0}
BS.09C | .6MM FLASHING C/B GIRTH 600MM FOLDS |
{0,1,2,3,4,5,6,7,8}
DN.TAPER | TAPPER CUTTING AND FOLDING SURCHARGE | {}
ST.13G | .6MM FLASHING GAL 601-800MM FOLDS | {0,1,2,3,4,5,6}
SR.06C | .6MM FLASHING C/B GIRTH 400MM FOLDS | {0,6,5,4,3,2,1}
(10 rows)
In the view as part of the debug I put this
<%=h @flashing.inspect() %>
which gave this result.
#<FlashingCode:0xb78791b8 @attributes={“code”=>“SR.05G”,
“description”=>".6MM FLASHING GAL GIRTH 300MM FOLDS",
“folds”=>"{5,4,3,2,1,0,6}"}>
Here is what the problem is this
<%=h @flashing.folds.inspect() if @flashing %>
only gives this as a result.
0
I can’t get the data from the folds array. I have no trouble getting
any of the other fields in this view, or any other table/view I have
setup.
Can anyone give me an idea what’s going on?
Regards Neil.