Is "oid" a unique id? You should be able to do something along the
lines of the following:
class Personality < ActiveRecord::Base
set_primary_key "oid"
set_table_name "pg_enum"
default_scope :order => 'oid',
:conditions => "enumtypid ='personality'::regtype ",
:select => "oid, enumlabel"
def to_label
enumlabel
end
end
class Person < ActiveRecord::Base
belongs_to :personality
end
class PeopleController < ApplicationController
active_scaffold :people do |config|
config.columns =[:name, :age, :personality]
config.columns[:personality].form_ui = :select
end
end
If that doesn't do it for some reason you can look at other methods in
the api that might work for you.
http://api.rubyonrails.org/classes/ActiveRecord/Base.html
Regards,
Kerry
On May 20, 9:07 pm, mickey <[email protected]> wrote:
> Hi Thanks for trying to help out.
>
> I may have found a solution, but unsure on how to use it. Basically
> with postgres, I can do a query to get the values for the custom data
> type like so:
>
> SELECT enumlabel
> FROM pg_enum
> WHERE enumtypid = 'personality'::regtype
> ORDER BY oid;
>
> And that would reutrn all the values for "personality".
>
> But now that I know I can execute that query so I can get the values,
> how do I fit that in within the active scaffold framework?
> Particularly, how would i have active scaffold to show a select box
> with these values when the user hits the create new link?
>
> Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---