Accessing data in a separate table w/out relationship

This question has two parts

  1. I currently have setup two models and 1 controller. In the view of
    the controller I have setup a form with a select form component and
    would like the values of this select component to be filled with ALL
    values of a particular component in the colum of the second model.

Example-

Table 1: id name comment
Table 2: id comment

I do not want to use any relationship (as in has_many, etc.) here
because I hope in the future to allow the user to be able to add their
own comment if they do not find a comment in the select component that
they like. Can this be done without explicity stating SQL in the
find_by_sql command.

Thanks,
Benjamin

On 9/19/06, Benjamin H. [email protected] wrote:

Table 1: id name comment

Acts_as_dropdown may be what you want:

http://delynnberry.com/pages/acts_as_dropdown/

Cheers,
Max

I’d rather not use a plugin. Are there any work-arounds?

On 9/19/06, Benjamin H. [email protected] wrote:

I’d rather not use a plugin. Are there any work-arounds?

Use

<%= collection_select ‘model_1_name’, ‘comment’, Comment.find(:all),
‘id’, ‘name’ %>

and read up here:

http://wiki.rubyonrails.org/rails/pages/HowtoUseFormOptionHelpers

Cheers,
Max

Max M. wrote:

On 9/19/06, Benjamin H. [email protected] wrote:

I’d rather not use a plugin. Are there any work-arounds?

Use

<%= collection_select ‘model_1_name’, ‘comment’, Comment.find(:all),
‘id’, ‘name’ %>

and read up here:

http://wiki.rubyonrails.org/rails/pages/HowtoUseFormOptionHelpers

Cheers,
Max

Thanks