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"}, {} %>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
On Mar 23, 6:14 pm, Amitabh A <chanak...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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> 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"}, {} %>--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Mar 23, 6:14 pm, Amitabh A <chanak...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 > > > 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"}, {} %>--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---