Skip to content

Commit

Permalink
Rewrite to match current form helpers interface
Browse files Browse the repository at this point in the history
  • Loading branch information
scudco committed Mar 2, 2014
1 parent ea73062 commit 231fb81
Show file tree
Hide file tree
Showing 10 changed files with 232 additions and 227 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ gemspec
# Duplicating this in Gemfile until thoughtbot pushes latest version # Duplicating this in Gemfile until thoughtbot pushes latest version
# that supports Bundler `platform` directive for rbx support in travis-ci # that supports Bundler `platform` directive for rbx support in travis-ci
# Once appraisal 1.0.0 is released, this line can be removed # Once appraisal 1.0.0 is released, this line can be removed
gem 'appraisal', github: 'thoughtbot/appraisal', ref: '6d599f' gem 'appraisal', '~> 1.0.0.beta3'


platforms :rbx do platforms :rbx do
gem 'racc' gem 'racc'
Expand Down
27 changes: 10 additions & 17 deletions README.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ to evaluate the suitability of this list given their user base.


## UPGRADING ## UPGRADING


[**An important message about upgrading from 1.0**](UPGRADING.md) [**An important message about upgrading from 1.x**](UPGRADING.md)


## Installation ## Installation


Expand All @@ -36,7 +36,13 @@ country_select("user", "country")
Supplying priority countries to be placed at the top of the list: Supplying priority countries to be placed at the top of the list:


```ruby ```ruby
country_select("user", "country", [ "GB", "FR", "DE" ]) country_select("user", "country", priority_countries: ["GB", "FR", "DE"])
```

Supplying only certain countries:

```ruby
country_select("user", "country", only: ["GB", "FR", "DE"])
``` ```


### ISO 3166-1 alpha-2 codes ### ISO 3166-1 alpha-2 codes
Expand Down Expand Up @@ -68,15 +74,7 @@ resistant to country names changing.
The locale can be overridden locally: The locale can be overridden locally:


```ruby ```ruby
country_select("user", "country_code", ['US'], locale: 'es') country_select("user", "country_code", locale: 'es')
```

```ruby
country_select("user", "country_code")
```

```ruby
country_select("user", "country_code", [ "GB", "FR", "DE" ])
``` ```


#### Getting the Country Name from the countries gem #### Getting the Country Name from the countries gem
Expand Down Expand Up @@ -105,13 +103,8 @@ The relevant view file lives [here](https://github.com/scudco/country_select_tes


```shell ```shell
bundle bundle
bundle exec rspec
```

### Running with multiple versions of actionpack

```shell
bundle exec appraisal bundle exec appraisal
bundle exec rake appraisal:integration
``` ```


Copyright (c) 2008 Michael Koziarski, released under the MIT license Copyright (c) 2008 Michael Koziarski, released under the MIT license
20 changes: 20 additions & 0 deletions UPGRADING.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -32,6 +32,26 @@ lowercased country codes stored in the `country_code` column:
UPDATE users SET country_code = UPPER(country_code); UPDATE users SET country_code = UPPER(country_code);
``` ```


## Priority countries are now in the options hash

The priority countries syntax has changed from

```ruby
country_select(:user, :country_code, ["GB","FR"])
```

to

```ruby
country_select(:user, :country_code, priority_countries: ["GB","FR"])
```

## You can choose to only display a chosen set of countries

```ruby
country_select(:user, :country_code, only: ["LV","SG"])
```

## Ruby 1.9+ ## Ruby 1.9+


`country_select` will no longer be tested in Ruby `< 1.9`. `country_select` will no longer be tested in Ruby `< 1.9`.
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/actionpack4.0.gemfile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


source "https://rubygems.org" source "https://rubygems.org"


gem "appraisal", :github=>"thoughtbot/appraisal", :ref=>"6d599f" gem "appraisal", "~> 1.0.0.beta3"
gem "actionpack", "~> 4.0.0" gem "actionpack", "~> 4.0.0"


platforms :rbx do platforms :rbx do
Expand Down
36 changes: 15 additions & 21 deletions gemfiles/actionpack4.0.gemfile.lock
Original file line number Original file line Diff line number Diff line change
@@ -1,13 +1,3 @@
GIT
remote: git://github.com/thoughtbot/appraisal.git
revision: 6d599ff1f2418d199ba2357b7c0297a63521ab13
ref: 6d599f
specs:
appraisal (1.0.0.beta2)
bundler
rake
thor (>= 0.14.0)

PATH PATH
remote: ../ remote: ../
specs: specs:
Expand All @@ -17,19 +7,23 @@ PATH
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actionpack (4.0.0) actionpack (4.0.3)
activesupport (= 4.0.0) activesupport (= 4.0.3)
builder (~> 3.1.0) builder (~> 3.1.0)
erubis (~> 2.7.0) erubis (~> 2.7.0)
rack (~> 1.5.2) rack (~> 1.5.2)
rack-test (~> 0.6.2) rack-test (~> 0.6.2)
activesupport (4.0.0) activesupport (4.0.3)
i18n (~> 0.6, >= 0.6.4) i18n (~> 0.6, >= 0.6.4)
minitest (~> 4.2) minitest (~> 4.2)
multi_json (~> 1.3) multi_json (~> 1.3)
thread_safe (~> 0.1) thread_safe (~> 0.1)
tzinfo (~> 0.3.37) tzinfo (~> 0.3.37)
atomic (1.1.10) appraisal (1.0.0.beta3)
bundler
rake
thor (>= 0.14.0)
atomic (1.1.15)
builder (3.1.4) builder (3.1.4)
coderay (1.0.9) coderay (1.0.9)
countries (0.9.3) countries (0.9.3)
Expand All @@ -38,10 +32,10 @@ GEM
diff-lcs (1.2.4) diff-lcs (1.2.4)
erubis (2.7.0) erubis (2.7.0)
ffi2-generators (0.1.1) ffi2-generators (0.1.1)
i18n (0.6.4) i18n (0.6.9)
method_source (0.8.1) method_source (0.8.1)
minitest (4.7.5) minitest (4.7.5)
multi_json (1.7.7) multi_json (1.8.4)
pry (0.9.12.2) pry (0.9.12.2)
coderay (~> 1.0.5) coderay (~> 1.0.5)
method_source (~> 0.8) method_source (~> 0.8)
Expand All @@ -51,7 +45,7 @@ GEM
rack (1.5.2) rack (1.5.2)
rack-test (0.6.2) rack-test (0.6.2)
rack (>= 1.0) rack (>= 1.0)
rake (10.1.0) rake (10.1.1)
rspec (2.13.0) rspec (2.13.0)
rspec-core (~> 2.13.0) rspec-core (~> 2.13.0)
rspec-expectations (~> 2.13.0) rspec-expectations (~> 2.13.0)
Expand Down Expand Up @@ -264,16 +258,16 @@ GEM
rubysl-zlib (2.0.1) rubysl-zlib (2.0.1)
slop (3.4.5) slop (3.4.5)
thor (0.18.1) thor (0.18.1)
thread_safe (0.1.0) thread_safe (0.2.0)
atomic atomic (>= 1.1.7, < 2)
tzinfo (0.3.37) tzinfo (0.3.38)


PLATFORMS PLATFORMS
ruby ruby


DEPENDENCIES DEPENDENCIES
actionpack (~> 4.0.0) actionpack (~> 4.0.0)
appraisal! appraisal (~> 1.0.0.beta3)
country_select! country_select!
pry (~> 0) pry (~> 0)
psych psych
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/actionpack4.1.gemfile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


source "https://rubygems.org" source "https://rubygems.org"


gem "appraisal", :github=>"thoughtbot/appraisal", :ref=>"6d599f" gem "appraisal", "~> 1.0.0.beta3"
gem "actionpack", "~> 4.1.0.beta1" gem "actionpack", "~> 4.1.0.beta1"


platforms :rbx do platforms :rbx do
Expand Down
36 changes: 15 additions & 21 deletions gemfiles/actionpack4.1.gemfile.lock
Original file line number Original file line Diff line number Diff line change
@@ -1,13 +1,3 @@
GIT
remote: git://github.com/thoughtbot/appraisal.git
revision: 6d599ff1f2418d199ba2357b7c0297a63521ab13
ref: 6d599f
specs:
appraisal (1.0.0.beta2)
bundler
rake
thor (>= 0.14.0)

PATH PATH
remote: .././ remote: .././
specs: specs:
Expand All @@ -17,22 +7,26 @@ PATH
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actionpack (4.1.0.beta1) actionpack (4.1.0.rc1)
actionview (= 4.1.0.beta1) actionview (= 4.1.0.rc1)
activesupport (= 4.1.0.beta1) activesupport (= 4.1.0.rc1)
rack (~> 1.5.2) rack (~> 1.5.2)
rack-test (~> 0.6.2) rack-test (~> 0.6.2)
actionview (4.1.0.beta1) actionview (4.1.0.rc1)
activesupport (= 4.1.0.beta1) activesupport (= 4.1.0.rc1)
builder (~> 3.1) builder (~> 3.1)
erubis (~> 2.7.0) erubis (~> 2.7.0)
activesupport (4.1.0.beta1) activesupport (4.1.0.rc1)
i18n (~> 0.6, >= 0.6.9) i18n (~> 0.6, >= 0.6.9)
json (~> 1.7, >= 1.7.7) json (~> 1.7, >= 1.7.7)
minitest (~> 5.1) minitest (~> 5.1)
thread_safe (~> 0.1) thread_safe (~> 0.1)
tzinfo (~> 1.1) tzinfo (~> 1.1)
atomic (1.1.14) appraisal (1.0.0.beta3)
bundler
rake
thor (>= 0.14.0)
atomic (1.1.15)
builder (3.2.2) builder (3.2.2)
coderay (1.1.0) coderay (1.1.0)
countries (0.9.3) countries (0.9.3)
Expand All @@ -44,7 +38,7 @@ GEM
i18n (0.6.9) i18n (0.6.9)
json (1.8.1) json (1.8.1)
method_source (0.8.2) method_source (0.8.2)
minitest (5.2.2) minitest (5.3.0)
pry (0.9.12.4) pry (0.9.12.4)
coderay (~> 1.0) coderay (~> 1.0)
method_source (~> 0.8) method_source (~> 0.8)
Expand Down Expand Up @@ -267,8 +261,8 @@ GEM
rubysl-zlib (2.0.1) rubysl-zlib (2.0.1)
slop (3.4.7) slop (3.4.7)
thor (0.18.1) thor (0.18.1)
thread_safe (0.1.3) thread_safe (0.2.0)
atomic atomic (>= 1.1.7, < 2)
tzinfo (1.1.0) tzinfo (1.1.0)
thread_safe (~> 0.1) thread_safe (~> 0.1)


Expand All @@ -277,7 +271,7 @@ PLATFORMS


DEPENDENCIES DEPENDENCIES
actionpack (~> 4.1.0.beta1) actionpack (~> 4.1.0.beta1)
appraisal! appraisal (~> 1.0.0.beta3)
country_select! country_select!
pry (~> 0) pry (~> 0)
psych psych
Expand Down
Loading

0 comments on commit 231fb81

Please sign in to comment.