alchemy_domains 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
Binary file
|
@@ -16,9 +16,14 @@ module Alchemy
|
|
16
16
|
@domain = AlchemyDomains::Domain.find_by_hostname(request.host)
|
17
17
|
if @domain
|
18
18
|
session[:domain_id] ||= @domain.id
|
19
|
-
|
20
|
-
redirect_to request.protocol +
|
19
|
+
elsif default_domain = AlchemyDomains::Domain.default
|
20
|
+
redirect_to request.protocol + default_domain.hostname, :status => 301
|
21
21
|
return false
|
22
|
+
else
|
23
|
+
# No Domains found. We need to create the requested.
|
24
|
+
@domain = AlchemyDomains::Domain.create!(:hostname => request.host)
|
25
|
+
@domain.localizations.create!(:language => Language.get_default)
|
26
|
+
session[:domain_id] = @domain.id
|
22
27
|
end
|
23
28
|
end
|
24
29
|
|
@@ -52,7 +57,7 @@ module Alchemy
|
|
52
57
|
if @language
|
53
58
|
store_language_in_session(@language)
|
54
59
|
else
|
55
|
-
raise "No Default Language for requested Domain found! Did you run `rake
|
60
|
+
raise "No Default Language for requested Domain found! Did you run `rake alchemy_domains:add:domain` task?"
|
56
61
|
end
|
57
62
|
end
|
58
63
|
|
@@ -8,7 +8,9 @@ module AlchemyDomains
|
|
8
8
|
validates_presence_of :hostname
|
9
9
|
validates_uniqueness_of :hostname
|
10
10
|
validates_presence_of :default, :message => "Es muss eine Standard Domain geben", :if => proc { |m| m.default_changed? && m.default_was == true }
|
11
|
-
|
11
|
+
# locahost is not valid, so we cant validate the format like that.
|
12
|
+
#validates_format_of :hostname, :with => /^[a-z\d]+([\-\.][a-z\d]+)*\.[a-z]{2,6}/
|
13
|
+
validates_format_of :hostname, :with => /^[a-z\d]+([\-\.][a-z\d]+)/
|
12
14
|
|
13
15
|
before_create :set_to_default, :if => proc { |m| Domain.default.blank? && self.default == false }
|
14
16
|
before_save :remove_old_default, :if => proc { |m| m.default_changed? && m != Domain.default }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alchemy_domains
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-03-28 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &70098845456700 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.1.3
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70098845456700
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: alchemy_cms
|
27
|
-
requirement: &
|
27
|
+
requirement: &70098841742440 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 2.1.7
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70098841742440
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: sqlite3
|
38
|
-
requirement: &
|
38
|
+
requirement: &70098841741940 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70098841741940
|
47
47
|
description: This gem adds domains and associats them with languages. Your website
|
48
48
|
can provide certain languages depending on the requested domain.
|
49
49
|
email:
|
@@ -52,6 +52,7 @@ executables: []
|
|
52
52
|
extensions: []
|
53
53
|
extra_rdoc_files: []
|
54
54
|
files:
|
55
|
+
- app/assets/images/alchemy_domains/module_icon.png
|
55
56
|
- app/controllers/alchemy/alchemy_base_controller_extension.rb
|
56
57
|
- app/controllers/alchemy/pages_controller_extension.rb
|
57
58
|
- app/controllers/alchemy_domains/admin/domains_controller.rb
|
@@ -94,7 +95,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
94
95
|
version: '0'
|
95
96
|
segments:
|
96
97
|
- 0
|
97
|
-
hash: -
|
98
|
+
hash: -579412331182660416
|
98
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
100
|
none: false
|
100
101
|
requirements:
|
@@ -103,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
104
|
version: '0'
|
104
105
|
segments:
|
105
106
|
- 0
|
106
|
-
hash: -
|
107
|
+
hash: -579412331182660416
|
107
108
|
requirements: []
|
108
109
|
rubyforge_project:
|
109
110
|
rubygems_version: 1.8.10
|