Select updates database?


#1

I am running on Rails 2.2.2 on Solaris (and also on my mac) against
mysql. For some reason, when I use a select in the partial, the
database does not get updated with the changed value. I am using
checkbox for other fields which works perfectly.
I can provide more information if needed, but I would like the field
to work as a dropdown instead of a text field.

My Model:
has_and_belongs_to_many :industries, :join_table =>
“grant_loans_industry”, :foreign_key =>
“grant_loans_id”, :association_foreign_key => “industry_id”
belongs_to :state

My Controller:
before_filter :login_required

layout “admin”
active_scaffold :grant_loan do |config|
config.list.columns = [:agency, :gov_type, :title, :url]
config.columns.exclude :state_name
config.label = ‘Grants and Loans’
columns[:state].form_ui = :select
columns[:industries].form_ui = :select
end

Partial:
<%= select :grant_loan, :business_type, [‘for_profit’,‘non_profit’],
{:selected => @record.business_type, :prompt => “Select The Business
Type”}, {} %>


#2

On Mar 23, 6:14 pm, Amitabh A removed_email_address@domain.invalid wrote:

I am running on Rails 2.2.2 on Solaris (and also on my mac) against
mysql. For some reason, when I use a select in the partial, the
database does not get updated with the changed value. I am using
checkbox for other fields which works perfectly.
I can provide more information if needed, but I would like the field
to work as a dropdown instead of a text field.

ActiveScaffold expects things to be named in particular ways, I expect
the select box you’ve generated isn’t created parameters named the way
it wants. You might be able to work out what the parameters should
look like by letting activescaffold generate what it wants (ie don’t
use your partial) and seeing where the differences are. There’s also
an activescaffold google group out there.

Fred


#3

Thanks, I will look at the active_scaffold group as well.
If I don’t find the answer, I will post there.

On Mar 23, 2:51 pm, Frederick C. removed_email_address@domain.invalid