# Select updates database?

**URL:** <https://www.ruby-forum.com/t/select-updates-database/163670>\
**Category:** Rails\
**Created:** [March 23, 2009, 7:48pm UTC](https://www.ruby-forum.com/t/select-updates-database/163670 "2009-03-23T19:48:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amitabh\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/d2c977/32.png) [@Amitabh\_A](https://www.ruby-forum.com/u/Amitabh_A)\
**Post date:** [March 23, 2009, 7:48pm UTC](https://www.ruby-forum.com/t/select-updates-database/163670/1 "2009-03-23T19:48:08Z")

</div>

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”}, {} %\>

---

<div class="post-metadata">

**Author:** ![Amitabh\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/d2c977/32.png) [@Amitabh\_A](https://www.ruby-forum.com/u/Amitabh_A)\
**Post date:** [March 23, 2009, 7:52pm UTC](https://www.ruby-forum.com/t/select-updates-database/163670/2 "2009-03-23T19:52:16Z")

</div>

On Mar 23, 6:14 pm, Amitabh A [removed\_email\_address@domain.invalid](mailto: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

---

<div class="post-metadata">

**Author:** ![Amitabh\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/d2c977/32.png) [@Amitabh\_A](https://www.ruby-forum.com/u/Amitabh_A)\
**Post date:** [March 24, 2009, 3:06pm UTC](https://www.ruby-forum.com/t/select-updates-database/163670/3 "2009-03-24T15:06:03Z")

</div>

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](mailto:removed_email_address@domain.invalid)
