A rich type is a class, so you can use a polymorphic tag.
<def tag="input" for="Folder">
<select name="¶m_name_for_this">
<%= options_for_select this.some_function_you_created -%>
</select>
</def>
Steve VanB wrote:
> Thanks! This is helpful for storing and rendering the items.
>
> how do I create a <select> to edit them? I can't seem to find any
> info on creating editors for rich types.
>
> Thanks again.
>
> Steve.
>
> On Jul 7, 9:58 am, Bryan Larsen <[email protected]> wrote:
>> Your ERB (or something very similar) should work in DRYML, too.
>>
>> Doing it at the model level will make life cleaner for you. The best
>> way would be to define arich type:
>> http://cookbook.hobocentral.net/manual/hobofields/rich_types
>>
>> My thought would be to set COLUMN_TYPE to :string to hold your code,
>> and then look up the translation in to_html.
>>
>> cheers,
>> Bryan
>>
>> On Jul 7, 9:27 am, Steve VanB <[email protected]> wrote:
>>
>>> I'm working with a legacy system that stores all of it'sselect(drop-
>>> down) options for all fields in one table. Here's a model of the
>>> table:
>>> class Translation < ActiveRecord::Base
>>> hobo_model
>>> set_primary_key "TranslationID"
>>> fields do
>>> TableName :string, :limit => 40
>>> FieldName :string, :limit => 40
>>> Code :string, :limit => 5
>>> Description :string, :limit => 65
>>> end
>>> end
>>> Where Table name is the name of the table the particular option is
>>> for, FieldName is the name of the field it's for, Code is what is to
>>> be stored in the field, and Description is what's displayed in the
>>> drop-down. The primary key is yet another field that's not used in
>>> this arrangement.
>>> So I need to be able to do a custom query for each field that needs a
>>> drop-down, radio buttons, or whatever, to be able to populate it
>>> appropriately.
>>> I've got it working in a non-hobo rails app by adding code to the view
>>> to get the data for me:
>>> <%= folder_form.collection_select :EmailCode, Translation.find
>>> (:all, :conditions => {:TableName => 'Folder', :FieldName =>
>>> 'EmailCode'}), :Code, :Description, :include_blank => true %>
>>> I should be able to have something at the model layer in hobo to do
>>> this though. How would I do this?
>>> Thanks!
>>> Steve.
>>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo
Users" 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/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---