Guest User

Untitled

a guest
May 23rd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. def globalize_country_select(name, selected='')
  2. first = Country.find(:all, :conditions => ["code in (?)", Priority_countries])
  3. first_options = options_for_select(first.collect { |x| [x.send('english_name'),x.send('code').downcase] }, selected)
  4. #divider = '<option value="">-------------</option>'
  5. selected = '' if Priority_countries.include? selected
  6. #all_countries = options_for_select(Country.find(:all,:order=>'english_name').to_select('english_name','code'), selected)
  7. select_tag(name, first_options, {:style => 'width:120px', :onchange =>"document.location.href ='#{ url_for :controller => 'application', :action => 'index', :locale => ''}' + $(new_country).value"}) # + divider + all_countries)
  8. end
Add Comment
Please, Sign In to add comment