Hi I have the models company,country, state company belongs_to country country has_many states state belongs_to country In my company creation view i have two select boxes for country and state. I could implement the country select like <% form_for @company do |f| %> <%= f.collection_select :country_id, Country.all, :id,:name,{},{} %> --- Upon submit country is save with company .This is working. Now I dont know how to populate the state And also I have to change the state select box according to change in country.Please guide me Thanks Tom -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Sharagoz --
2010-Feb-15 09:57 UTC
Re: state select box to be populated according to country
Ryan Bates got a railscasts episode that deals with this exact case: http://railscasts.com/episodes/88-dynamic-select-menus -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi> Ryan Bates got a railscasts episode that deals with this exact case: > http://railscasts.com/episodes/88-dynamic-select-menusThanks for your reply. I have tried this But is not working My rails version is 2.3.5 I have added map.connect '':controller/:action/:id.:format'' to routes.r as suggested. But in any way I cant access http://localhost:3001/javascripts/dynamic_states.js I am getting Routing Error No route matches "/javascripts/dynamic_states.js" with {:method=>:get} Tom -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Lasse Bunk
2010-Feb-15 18:28 UTC
Re: Re: state select box to be populated according to country
You need to but dynamic_states.js in your public/javascripts folder. --Lasse 2010/2/15 Tom Mac <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>> Hi > > Ryan Bates got a railscasts episode that deals with this exact case: > > http://railscasts.com/episodes/88-dynamic-select-menus > Thanks for your reply. I have tried this But is not working My rails > version is 2.3.5 I have added map.connect > '':controller/:action/:id.:format'' > to routes.r as suggested. But in any way I cant access > http://localhost:3001/javascripts/dynamic_states.js > I am getting > > Routing Error > > No route matches "/javascripts/dynamic_states.js" with {:method=>:get} > > > Tom > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Tom Mac
2010-Feb-16 03:33 UTC
Re: Re: state select box to be populated according to country
Lasse Bunk wrote:> You need to but dynamic_states.js in your public/javascripts folder. > > --Lasse >But how is it possible? In screencast it is dynamic_states.js.erb that contains both ruby and javascript code. So how can i put that to public/javascripts? Tom -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
kwerle-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org
2010-Feb-16 04:27 UTC
Re: state select box to be populated according to country
On Feb 15, 1:18 am, Tom Mac <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hi > I have the models company,country, stateYou might avoid a lot of work by using the Carmen plugin (or one like it): http://github.com/jim/carmen --- Kurt Werle I am looking for a new rails job: http://www.CircleW.org/kurt/pages/resume -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.