rails-ext 0.3.17 → 0.3.18

Sign up to get free protection for your applications and to get access to all the features.
data/.git/index CHANGED
Binary file
data/.git/logs/HEAD CHANGED
@@ -70,3 +70,5 @@ cda2dd4b5ecbc69fa1b1ebf09c580ba17bf69656 268fe011dd9d01aa6e05c2004280b78e149ea29
70
70
  268fe011dd9d01aa6e05c2004280b78e149ea29e 4001df088dada11d1dc4f0a197f3ee74db62a376 alex <alex@amac.local> 1272706336 +0400 commit: upd
71
71
  4001df088dada11d1dc4f0a197f3ee74db62a376 6d8daa98dd7a0922a838ee0d274247693d7d9ac2 alex <alex@amac.local> 1272710100 +0400 commit: upd
72
72
  6d8daa98dd7a0922a838ee0d274247693d7d9ac2 3566bd5be950e4b626366b4cb2909838729bc66c alex <alex@amac.local> 1272710613 +0400 commit: upd
73
+ 3566bd5be950e4b626366b4cb2909838729bc66c a5fe3c8ef2b84dbebb2181ceaebec710f5b163d4 alex <alex@amac.local> 1272739313 +0400 commit: upd language
74
+ a5fe3c8ef2b84dbebb2181ceaebec710f5b163d4 0573ef490a937cd853c8d8d6affb63851451e0a3 alex <alex@amac.local> 1272795016 +0400 commit: upd
@@ -70,3 +70,5 @@ cda2dd4b5ecbc69fa1b1ebf09c580ba17bf69656 268fe011dd9d01aa6e05c2004280b78e149ea29
70
70
  268fe011dd9d01aa6e05c2004280b78e149ea29e 4001df088dada11d1dc4f0a197f3ee74db62a376 alex <alex@amac.local> 1272706336 +0400 commit: upd
71
71
  4001df088dada11d1dc4f0a197f3ee74db62a376 6d8daa98dd7a0922a838ee0d274247693d7d9ac2 alex <alex@amac.local> 1272710100 +0400 commit: upd
72
72
  6d8daa98dd7a0922a838ee0d274247693d7d9ac2 3566bd5be950e4b626366b4cb2909838729bc66c alex <alex@amac.local> 1272710613 +0400 commit: upd
73
+ 3566bd5be950e4b626366b4cb2909838729bc66c a5fe3c8ef2b84dbebb2181ceaebec710f5b163d4 alex <alex@amac.local> 1272739313 +0400 commit: upd language
74
+ a5fe3c8ef2b84dbebb2181ceaebec710f5b163d4 0573ef490a937cd853c8d8d6affb63851451e0a3 alex <alex@amac.local> 1272795016 +0400 commit: upd
@@ -56,3 +56,4 @@ cda2dd4b5ecbc69fa1b1ebf09c580ba17bf69656 268fe011dd9d01aa6e05c2004280b78e149ea29
56
56
  268fe011dd9d01aa6e05c2004280b78e149ea29e 4001df088dada11d1dc4f0a197f3ee74db62a376 alex <alex@amac.local> 1272706342 +0400 update by push
57
57
  4001df088dada11d1dc4f0a197f3ee74db62a376 6d8daa98dd7a0922a838ee0d274247693d7d9ac2 alex <alex@amac.local> 1272710105 +0400 update by push
58
58
  6d8daa98dd7a0922a838ee0d274247693d7d9ac2 3566bd5be950e4b626366b4cb2909838729bc66c alex <alex@amac.local> 1272710619 +0400 update by push
59
+ 3566bd5be950e4b626366b4cb2909838729bc66c 0573ef490a937cd853c8d8d6affb63851451e0a3 alex <alex@amac.local> 1272795025 +0400 update by push
@@ -1 +1 @@
1
- 3566bd5be950e4b626366b4cb2909838729bc66c
1
+ 0573ef490a937cd853c8d8d6affb63851451e0a3
@@ -1 +1 @@
1
- 3566bd5be950e4b626366b4cb2909838729bc66c
1
+ 0573ef490a937cd853c8d8d6affb63851451e0a3
data/Rakefile CHANGED
@@ -18,7 +18,7 @@ require 'fileutils'
18
18
 
19
19
  spec = Gem::Specification.new do |s|
20
20
  s.name = "rails-ext"
21
- s.version = "0.3.17"
21
+ s.version = "0.3.18"
22
22
  s.summary = "Set of common Ruby on Rails extensions"
23
23
  s.description = "Set of common Ruby on Rails extensions"
24
24
  s.author = "Alexey Petrushin"
@@ -11,8 +11,7 @@ ActionController::Base.class_eval do
11
11
  #
12
12
  def link_to text, uri
13
13
  %{<a href="#{uri}">#{text}</a>}
14
- end
15
-
14
+ end
16
15
 
17
16
  #
18
17
  # Bunch of small actions
@@ -87,8 +86,20 @@ ActionController::Base.class_eval do
87
86
  end
88
87
  end
89
88
  around_filter :catch_user_error
89
+
90
+ #
91
+ # enshure domain has www. except if there's custom subdomain
92
+ #
93
+ def ensure_www
94
+ if request.domain.count('.') < 2 and Rails.production? and request.domain !~ /localhost/
95
+ uri = Addressable::URI.parse request.url
96
+ uri.host = "www." + uri.host
97
+ redirect_to uri.to_s
98
+ end
99
+ end
90
100
 
91
101
  class << self
102
+
92
103
  def prepare_model aclass, opt = {}
93
104
  id = opt.delete(:id) || :id
94
105
  variable = opt.delete(:variable) || aclass.model_name.underscore
@@ -114,30 +114,30 @@ begin
114
114
  end
115
115
 
116
116
  # Prepare locale in Controller
117
- module ActionController
118
- module Acts
119
- module Localized
120
- def self.included(base)
121
- base.extend(ClassMethods)
122
- end
123
-
124
- module ClassMethods
125
- def acts_as_localized
126
- include ActionController::Acts::Localized::InstanceMethods
127
-
128
- before_filter :prepare_locale
129
- end
130
- end
131
-
132
- module InstanceMethods
133
- def prepare_locale
134
- I18n.locale = params[:l] unless params[:l].blank?
135
- end
136
- end
137
- end
138
- end
139
- end
140
- ActionController::Base.send :include, ActionController::Acts::Localized
117
+ # module ActionController
118
+ # module Acts
119
+ # module Localized
120
+ # def self.included(base)
121
+ # base.extend(ClassMethods)
122
+ # end
123
+ #
124
+ # module ClassMethods
125
+ # def acts_as_localized
126
+ # include ActionController::Acts::Localized::InstanceMethods
127
+ #
128
+ # before_filter :prepare_locale
129
+ # end
130
+ # end
131
+ #
132
+ # module InstanceMethods
133
+ # def prepare_locale
134
+ # I18n.locale = params[:l] unless params[:l].blank?
135
+ # end
136
+ # end
137
+ # end
138
+ # end
139
+ # end
140
+ # ActionController::Base.send :include, ActionController::Acts::Localized
141
141
  # rescue NameError
142
142
  # puts "i18n_helper (from rails_commons) disabled"
143
143
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 17
9
- version: 0.3.17
8
+ - 18
9
+ version: 0.3.18
10
10
  platform: ruby
11
11
  authors:
12
12
  - Alexey Petrushin
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-01 00:00:00 +04:00
17
+ date: 2010-05-02 00:00:00 +04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -72,6 +72,7 @@ files:
72
72
  - .git/objects/04/cd62e7f8158fe54d21e6f63617c43b593b8b59
73
73
  - .git/objects/05/0098e3b05f41a672127d5e730d322cec84e21c
74
74
  - .git/objects/05/38f41ddebf7fa8c71ebe99c5288d5e11c3fb86
75
+ - .git/objects/05/73ef490a937cd853c8d8d6affb63851451e0a3
75
76
  - .git/objects/05/9bdc20ed12957701f4b3931e2b1779de7adccf
76
77
  - .git/objects/06/c2384aa5f8b5614038b48a726d1d4f98a00f3b
77
78
  - .git/objects/06/c3225bad9d5b80e7b3bde79ff3c2da591722bf
@@ -93,6 +94,7 @@ files:
93
94
  - .git/objects/0d/b63ec7380f5132ca02be93c82f5295e33c10a9
94
95
  - .git/objects/0d/f02169bc94825e3629924eb44a662f07dc4dd8
95
96
  - .git/objects/0e/3e1ba37a5dde54955067f2281ed9a59498f6fc
97
+ - .git/objects/0e/569306967bfebd5fd43b846a852b684c7f49e9
96
98
  - .git/objects/0f/92cb7ae358323d43d026b83f7d1a4969cf7568
97
99
  - .git/objects/0f/d3ac42b07c2d3102263bd939704f5633db304e
98
100
  - .git/objects/10/1f52d83027dfe5798f87aec1118f02d19e5cf8
@@ -127,6 +129,7 @@ files:
127
129
  - .git/objects/1c/7fd48742e76d2cd6605e1a569e65e79ddd8f92
128
130
  - .git/objects/1d/3972733ede74012559f4c784b39ec66ff4166d
129
131
  - .git/objects/1d/d49713de2942dc974e55adc3684f55b2b817e2
132
+ - .git/objects/1e/48b01e103c5d1be1107bfd6d227eda271580c8
130
133
  - .git/objects/1e/6374b23c71a07b0e414e80912fd45503bd3daf
131
134
  - .git/objects/1e/b77bba4ef75c91f8d984ed6f9c3f91c66b5925
132
135
  - .git/objects/1e/d9ed5f46d17a0614d34795d6219443643c0f02
@@ -197,6 +200,7 @@ files:
197
200
  - .git/objects/3b/354d07a5bb5780eeffa4c12968214b1edb8b24
198
201
  - .git/objects/3b/cebd028c4b8312b2c36b14eddb57836c328a67
199
202
  - .git/objects/3b/da284efc6c07900db7dd00a9f3082d2c13d55e
203
+ - .git/objects/3c/2d2112bcfaab44b4c9385a1e57a9fa74e4dab1
200
204
  - .git/objects/3c/994e760012127915c1494a073cea51ef3b43e8
201
205
  - .git/objects/3d/5b84167d35cb75647f38a6d475a452ba3c6178
202
206
  - .git/objects/3d/ce52a15f01f1a8f99e65d148341bea71065129
@@ -269,6 +273,7 @@ files:
269
273
  - .git/objects/5c/e57246e73624ffb1eb0eee1375f42d8f8b8764
270
274
  - .git/objects/5d/c38b1f2d3893c8e41b05de2d121b525f888e5c
271
275
  - .git/objects/5f/483b0c41645f8882f549c1c6d0274bb592140a
276
+ - .git/objects/60/2f24a20e697369f97c5c20a77b3c713dab59d4
272
277
  - .git/objects/60/74f4e0c668417e06938cb77640240e9c2b6e0e
273
278
  - .git/objects/60/a42d757f842f6ce1a27284630ffd3deb867857
274
279
  - .git/objects/60/a681e873ca0ae0b7da3f37dbc5701f6e42b970
@@ -317,6 +322,7 @@ files:
317
322
  - .git/objects/73/667b7ae341d478513ba0bd6ec8af0aa1f62f0d
318
323
  - .git/objects/74/4d46a654ae9e0867055184f2011668c7e1acd2
319
324
  - .git/objects/74/8b7f980add2fb559bddc507a233426ec2880c4
325
+ - .git/objects/74/cbd0ceb2fd02c8b0db831b969c490e92c0ae99
320
326
  - .git/objects/74/ce4a58ebf96006e1e9be0980b99ac3b5b820c7
321
327
  - .git/objects/74/d8411c7276b4e1c1f614606af7f69ab4526d30
322
328
  - .git/objects/75/c64796b5ffb6107b861cfa77fa28e8e43a1156
@@ -329,6 +335,7 @@ files:
329
335
  - .git/objects/79/0a80b72f6f6f214ece6a3e71e818effc5c9e6e
330
336
  - .git/objects/79/4750e930e297c9616e902898f684967c2760c7
331
337
  - .git/objects/79/f570c126c66576fc1a5eaa52f003cf1b24e0d2
338
+ - .git/objects/7a/1d5b342eabedd35bb3c388eafcb6a42266e740
332
339
  - .git/objects/7a/d62f1e2a8e4af39d293ce70c5dca999263ab4e
333
340
  - .git/objects/7b/469d63569dcc92c82f90fc7a48793c31365f9a
334
341
  - .git/objects/7b/5c4d98eb195890b76abb20b73014d23554e655
@@ -340,6 +347,7 @@ files:
340
347
  - .git/objects/7d/6cd855bdf8661fab653f9f2de1195a6552e458
341
348
  - .git/objects/7d/978ee312ca2119dc84e40431182b8f68e42f53
342
349
  - .git/objects/7e/ca6f113845c2dcdf536daa084349445d608879
350
+ - .git/objects/7f/5a29b185109286dba66581a28bcbe2ec398f9a
343
351
  - .git/objects/80/1343ae84fe604b9fb93fb2265d2e3a49f25d3e
344
352
  - .git/objects/80/4a20e92f38623945cdb50ed8864d014632cf44
345
353
  - .git/objects/81/156e1461b12b90f0dc2604458317ca8f5d45c0
@@ -433,6 +441,7 @@ files:
433
441
  - .git/objects/a5/4db1bec30f7dc8981c4d5ccf9c9a90c1e13662
434
442
  - .git/objects/a5/601da690031d212d8325b0c23655c6f1f24dcc
435
443
  - .git/objects/a5/9472e8ecb5d06647adeec11ae931b956508191
444
+ - .git/objects/a5/fe3c8ef2b84dbebb2181ceaebec710f5b163d4
436
445
  - .git/objects/a6/438da91846df9ac940b59f6d11d5019a5580be
437
446
  - .git/objects/a7/6c4944dc009628cb65b4962464a8eb484d6a71
438
447
  - .git/objects/a7/a902aeac4af3f10b474c23c2a3750fde007a02
@@ -503,6 +512,7 @@ files:
503
512
  - .git/objects/c5/3b27c9641ea1c2aed192672b67ba8c4034b2ad
504
513
  - .git/objects/c5/64ac68ebc8e0db7a6355a45f3299829ef2a825
505
514
  - .git/objects/c5/9dfa6bb36393437844b2e4acd5452338d587a0
515
+ - .git/objects/c6/16f380978400df648417cbbd197680f7e1a451
506
516
  - .git/objects/c6/9db405143490c407206cf8afd7537a49ea30b2
507
517
  - .git/objects/c7/19fb334a65a20594437e2e6c944a08f30cfdf9
508
518
  - .git/objects/c7/a9ce2f4c2230143a30c77952c14ddf6507f511
@@ -524,6 +534,7 @@ files:
524
534
  - .git/objects/d1/38a420782e818f3f87c6c8c0a0a135639a30d9
525
535
  - .git/objects/d1/7ff61278b2c669eaab5f6d7f741c39f39e18f9
526
536
  - .git/objects/d2/85be6e2891e063625d4904c9bcca42bf6f0b83
537
+ - .git/objects/d2/e6c5c581e53fce6c86bec58d60e7ede3ec4a52
527
538
  - .git/objects/d3/090290f6f317ca51efd4d2913bc079ba115078
528
539
  - .git/objects/d4/1e2336bcd3ce3d09a9fa6c3af3270c29bd8457
529
540
  - .git/objects/d4/faaed37686ae3ce16b636defd37eeacb38470d