I'm working with a legacy system that stores all of it's select (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
-~----------~----~----~----~------~----~------~--~---