# Activerecord, postgres and views?

**URL:** <https://www.ruby-forum.com/t/activerecord-postgres-and-views/60961>\
**Category:** Ruby\
**Created:** [January 11, 2006, 12:38pm UTC](https://www.ruby-forum.com/t/activerecord-postgres-and-views/60961 "2006-01-11T12:38:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![S\_blackdog](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/5f8ce5/32.png) [@S\_blackdog](https://www.ruby-forum.com/u/S_blackdog)\
**Post date:** [January 11, 2006, 12:38pm UTC](https://www.ruby-forum.com/t/activerecord-postgres-and-views/60961/1 "2006-01-11T12:38:20Z")

</div>

hi there

is it possible to use a postgres view in AR?

this code is being executed by AR to find a relation

SELECT a.attname, format\_type(a.atttypid, a.atttypmod), d.adsrc,  
a.attnotnull FROM pg\_attribute a LEFT JOIN pg\_attrdef d  
ON a.attrelid = d.adrelid AND a.attnum = d.adnum  
WHERE a.attrelid = ‘iptrack’::regclass  
AND a.attnum \> 0 AND NOT a.attisdropped  
ORDER BY a.attnum

but it does not find my view “iptrack”.

i realise i may not be able to update my view without postgres rewrite  
rules, but I think i should be able to do searches on a view

thanks for any help

BD

---

<div class="post-metadata">

**Author:** ![S\_blackdog](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/5f8ce5/32.png) [@S\_blackdog](https://www.ruby-forum.com/u/S_blackdog)\
**Post date:** [January 11, 2006, 12:50pm UTC](https://www.ruby-forum.com/t/activerecord-postgres-and-views/60961/2 "2006-01-11T12:50:23Z")

</div>

sorry for the prior post, my mistake!  
doh!
