Hi
Im trying to figure out how to make selection list work
My example for this is a Real estate web site
download the code here: [URL="http://www.qcm.co.il/real-
estate.rar"]http://www.qcm.co.il/real-estate.rar[/URL]
I have a table named "assets" and a table named
"settlements"
and a relationship between them
[CODE]execute "alter table assets add constraint
fk_asset_settelments foreign key (settelment_id) references
settelments(id)"[/CODE]
in _form.rhtml the code is:
[CODE]<p><label
for="asset_settelment_id">Settelment</label><br />
<%= collection_select(:asset, :settelment_id,
Settelment.find(:all, :order => "settelment"), :id, :settelment,
options ={:prompt => "select"}, :class =>"settelment")
%>
</p>[/CODE]
when I try to update an asset settelment I get this error:
[QUOTE]NoMethodError in AssetController#update
undefined method `settelment_id='' for #<Asset:0x478694c>
RAILS_ROOT: ./script/../config/..
Application Trace | Framework Trace | Full Trace
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/base.rb:1857:in `method_missing''
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/base.rb:1672:in `send''
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/base.rb:1672:in `attributes=''
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/base.rb:1671:in `each''
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/base.rb:1671:in `attributes=''
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/base.rb:1591:in `update_attributes''
#{RAILS_ROOT}/app/controllers/asset_controller.rb:39:in `update''
Request
Parameters: {"commit"=>"Edit",
"id"=>"1",
"asset"=>{"plot_area"=>"3500",
"image_url"=>"",
"updated_at(1i)"=>"2008",
"updated_at(2i)"=>"4",
"created_at(1i)"=>"2008",
"created_at(2i)"=>"4",
"updated_at(3i)"=>"6",
"created_at(3i)"=>"6",
"updated_at(4i)"=>"09",
"settelment_id"=>"1",
"updated_at(5i)"=>"33",
"created_at(4i)"=>"09",
"created_at(5i)"=>"32",
"price_dolar"=>"1100000",
"price_shekel"=>"0",
"description"=>"Great house",
"built_area"=>"230"}}
Show session dump
Response
Headers: {"cookie"=>[],
"Cache-Control"=>"no-cache"}[/QUOTE]
Thank you in advance for your help
Please bear with me Im new to programing and my english is not perfect
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
you mix the spelling "settlements" and "settelments" -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
erez.bens-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Apr-06 19:38 UTC
Re: selection lists
Thanks Thorsten On 6 אפריל, 19:35, Thorsten Mueller <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> you mix the spelling "settlements" and "settelments" > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---