subdomain_locale 1.0.beta4 → 1.0.beta5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fdc1524b2a958bfe398f7f91a1f6d1890008aab9
4
- data.tar.gz: fac92758a062f7d198f9c474424be5742838abf9
3
+ metadata.gz: 749e76f7ece9b06223186583b7d207e557b37a40
4
+ data.tar.gz: 1b9cc4610f7e450943c8a06179855241a0cd0476
5
5
  SHA512:
6
- metadata.gz: 85ba896d50772f6e452bfb6142eb71f6ecc0fe6ecae13e1e2fa474e3dddcc9df47840b57a2f1beb088c547d9d3f4aa7c3871ffb76adb2d30975facb6a94d8c6c
7
- data.tar.gz: e84bfe39c6bc408828f14e186edde19a0c971588ef6b5af867a78639573bbb1d11d6f000b9e0be91d8558cca1fe03f941de81a52c1ee6631bcb282425e6a1dcc
6
+ metadata.gz: 9bab89ac779f0173ef5e41eb3ad49210cd849799fc72ace8a02bfa055f51148e1b06a175187773e28d6737c87a3047de69953f916b91ffadd5f81a24efa53f0c
7
+ data.tar.gz: 63c464a9cc6e82aa08892a4b7feba3535d046d6f8b8035d26e9bd5248cf9c6e6d289a97323a7de3b43ac74abf749b88fce8882df2b555a0502d65ff1b7cd2cdc
@@ -10,12 +10,12 @@ module SubdomainLocale
10
10
  def url_for(options=nil)
11
11
  if options.is_a?(Hash)
12
12
  options = options.dup
13
- if options.has_key?(:locale)
13
+ if options.key?(:locale)
14
14
  # Locale specified, force full URL
15
15
  locale = options.delete(:locale)
16
16
  options[:subdomain] = subdomain_locales.subdomain_for(locale)
17
17
  options[:only_path] = false
18
- elsif options.has_key?(:only_path) && !options[:only_path]
18
+ elsif options.key?(:only_path) && !options[:only_path] && !options.key?(:subdomain)
19
19
  # Requested full URL, use current locale
20
20
  options[:subdomain] = subdomain_locales.subdomain_for(current_locale)
21
21
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "subdomain_locale"
5
- spec.version = "1.0.beta4"
5
+ spec.version = "1.0.beta5"
6
6
  spec.authors = ["Semyon Perepelitsa"]
7
7
  spec.email = ["sema@sema.in"]
8
8
  spec.summary = "Set I18n locale based on subdomain"
@@ -3,6 +3,7 @@
3
3
  <%= link_to "English", root_path(locale: "en") %>
4
4
  <%= link_to "Russian", root_path(locale: "ru") %>
5
5
  <%= link_to "Ukrainian", root_path(locale: "uk") %>
6
+ <%= link_to "Beta", root_url(subdomain: "beta") %>
6
7
  </menu>
7
8
 
8
9
  <p><%= t "hello" %></p>
data/test/rails_test.rb CHANGED
@@ -10,6 +10,7 @@ class HelloControllerTest < ActionController::TestCase
10
10
  assert_equal "http://example.com/", menu[1]["href"]
11
11
  assert_equal "http://ru.example.com/", menu[2]["href"]
12
12
  assert_equal "http://ua.example.com/", menu[3]["href"]
13
+ assert_equal "http://beta.example.com/", menu[4]["href"]
13
14
  end
14
15
 
15
16
  def test_default
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: subdomain_locale
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.beta4
4
+ version: 1.0.beta5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Semyon Perepelitsa