awesome_translations 0.0.21 → 0.0.22

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: a93684d94a2fdf276c0ea1c2f26be9d3a68c8c5d
4
- data.tar.gz: 49eb049d055b8aea8f948328493c1a7f43497321
3
+ metadata.gz: 0db11c53b1264af880f8e3d4d85c86c5ccf45a2d
4
+ data.tar.gz: 88901c841052da30bab9aa283a3c802d815e418f
5
5
  SHA512:
6
- metadata.gz: 6ef50d3f79a00369847b0360a9d20a32b396a2bce37cc75133d36351c771cca2da81fe7b281539cf7499c3e8cc3d8df7ac1cdb745053db8e25cd641cda80eaef
7
- data.tar.gz: 4a8824daf505e00237b87e057e1f6dabbae635cbd76004975041e26179cc35edc8f763a3ca691fe4be0e4cc51cf73f0f797649dc0c0896319e7396e2ad859721
6
+ metadata.gz: d540294ffa83b79377c910622e5e55c0322debe43903265b8bf855bf7ff14d43daeaed1072f94dce4562a10ef62600723adce1263609a168b6a00b647e100737
7
+ data.tar.gz: 420590b3144cbaa13bed7e856619ba989c4b062f621553b44be59548684f5153241955afef6adc1141785c62a449de86f340d26a77173fb5f8e9f26375cdf214
data/README.md CHANGED
@@ -47,6 +47,23 @@ module ApplicationHelper
47
47
  end
48
48
  ```
49
49
 
50
+ ## Controller translations without action in key
51
+
52
+ Start by including this in your ApplicationController:
53
+ ```ruby
54
+ class ApplicationController
55
+ include AwesomeTranslations::ControllerTranslateFunctionality
56
+ ```
57
+
58
+ Then you can use the `controller_t`-method like this:
59
+ ```ruby
60
+ class UsersController < ApplicationController
61
+ def create
62
+ flash[:notice] = controller_t('.user_was_saved')
63
+ end
64
+ end
65
+ ```
66
+
50
67
  This is an example of how it works and what the difference is:
51
68
  ```ruby
52
69
  module ApplicationHelper
@@ -0,0 +1,14 @@
1
+ # Include this module to get access to the t-method.
2
+ module AwesomeTranslations::ControllerTranslateFunctionality
3
+ # Implements the method on both class- and instance-level.
4
+ def self.included(base)
5
+ base.__send__(:include, Methods)
6
+ base.extend Methods
7
+ end
8
+
9
+ module Methods
10
+ def controller_t(key, args = {}, &blk)
11
+ AwesomeTranslations::GlobalTranslator.translate(key, translation_args: [args], caller_number: 1, &blk)
12
+ end
13
+ end
14
+ end
@@ -1,3 +1,3 @@
1
1
  module AwesomeTranslations
2
- VERSION = '0.0.21'
2
+ VERSION = '0.0.22'
3
3
  end
@@ -5,6 +5,7 @@ module AwesomeTranslations
5
5
  path = "#{File.dirname(__FILE__)}/awesome_translations"
6
6
 
7
7
  autoload :Config, "#{path}/config"
8
+ autoload :ControllerTranslateFunctionality, "#{path}/controller_translate_functionality"
8
9
  autoload :ErbInspector, "#{path}/erb_inspector"
9
10
  autoload :GlobalTranslator, "#{path}/global_translator"
10
11
  autoload :Handlers, "#{path}/handlers"
@@ -17,4 +17,12 @@ describe UsersController do
17
17
  response.should be_success
18
18
  assigns(:users).should include user
19
19
  end
20
+
21
+ it "#update" do
22
+ patch :update, id: user.id, user: {email: "newemail@example.com"}
23
+ expect(response).to redirect_to user_url(user)
24
+
25
+ # Ensure correct key
26
+ expect(flash[:notice]).to eq 'translation missing: en.spec.dummy.app.controllers.users_controller.user_was_updated'
27
+ end
20
28
  end
@@ -1,4 +1,6 @@
1
1
  class ApplicationController < ActionController::Base
2
+ include AwesomeTranslations::ControllerTranslateFunctionality
3
+
2
4
  # Prevent CSRF attacks by raising an exception.
3
5
  # For APIs, you may want to use :null_session instead.
4
6
  protect_from_forgery with: :exception
@@ -2135,3 +2135,613 @@ Completed 302 Found in 14ms (ActiveRecord: 0.0ms)
2135
2135
   (0.0ms) rollback transaction
2136
2136
   (0.0ms) begin transaction
2137
2137
   (0.0ms) rollback transaction
2138
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
2139
+  (0.1ms) begin transaction
2140
+  (0.1ms) SAVEPOINT active_record_1
2141
+ User Exists (0.1ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = 'cmeyer@snaptags.biz' LIMIT 1
2142
+ SQL (2.4ms) INSERT INTO "users" ("age", "email", "password") VALUES (?, ?, ?) [["age", 0], ["email", "cmeyer@snaptags.biz"], ["password", "viverra eget"]]
2143
+  (0.1ms) RELEASE SAVEPOINT active_record_1
2144
+ Processing by UsersController#index as HTML
2145
+ User Load (0.2ms) SELECT "users".* FROM "users"
2146
+ Rendered users/index.html.haml within layouts/application (14.5ms)
2147
+ Completed 200 OK in 121ms (Views: 120.7ms | ActiveRecord: 0.2ms)
2148
+  (0.6ms) rollback transaction
2149
+  (0.1ms) begin transaction
2150
+  (0.0ms) SAVEPOINT active_record_1
2151
+ User Exists (0.1ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = 'ehenry@ntags.org' LIMIT 1
2152
+ SQL (0.2ms) INSERT INTO "users" ("age", "email", "password") VALUES (?, ?, ?) [["age", 8], ["email", "ehenry@ntags.org"], ["password", "vel est"]]
2153
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2154
+ Processing by UsersController#update as HTML
2155
+ Parameters: {"user"=>{"email"=>"newemail@example.com"}, "id"=>"1"}
2156
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
2157
+  (0.0ms) SAVEPOINT active_record_1
2158
+ User Exists (0.1ms) SELECT 1 AS one FROM "users" WHERE ("users"."email" = 'newemail@example.com' AND "users"."id" != 1) LIMIT 1
2159
+ SQL (1.2ms) UPDATE "users" SET "email" = ? WHERE "users"."id" = 1 [["email", "newemail@example.com"]]
2160
+  (0.1ms) RELEASE SAVEPOINT active_record_1
2161
+ Completed 500 Internal Server Error in 5ms
2162
+  (0.6ms) rollback transaction
2163
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
2164
+  (0.1ms) begin transaction
2165
+  (0.0ms) SAVEPOINT active_record_1
2166
+ User Exists (0.1ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = 'bbailey@twimbo.biz' LIMIT 1
2167
+ SQL (1.6ms) INSERT INTO "users" ("age", "email", "password") VALUES (?, ?, ?) [["age", 10], ["email", "bbailey@twimbo.biz"], ["password", "ipsum praesent"]]
2168
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2169
+ Processing by UsersController#update as HTML
2170
+ Parameters: {"user"=>{"email"=>"newemail@example.com"}, "id"=>"1"}
2171
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
2172
+  (0.0ms) SAVEPOINT active_record_1
2173
+ User Exists (0.1ms) SELECT 1 AS one FROM "users" WHERE ("users"."email" = 'newemail@example.com' AND "users"."id" != 1) LIMIT 1
2174
+ SQL (1.1ms) UPDATE "users" SET "email" = ? WHERE "users"."id" = 1 [["email", "newemail@example.com"]]
2175
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2176
+ Completed 500 Internal Server Error in 5ms
2177
+  (7.1ms) rollback transaction
2178
+  (0.1ms) begin transaction
2179
+  (0.1ms) SAVEPOINT active_record_1
2180
+ User Exists (0.2ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = 'amendoza@edgepulse.info' LIMIT 1
2181
+ SQL (0.3ms) INSERT INTO "users" ("age", "email", "password") VALUES (?, ?, ?) [["age", 10], ["email", "amendoza@edgepulse.info"], ["password", "primis in"]]
2182
+  (0.1ms) RELEASE SAVEPOINT active_record_1
2183
+ Processing by UsersController#index as HTML
2184
+ User Load (0.1ms) SELECT "users".* FROM "users"
2185
+ Completed 200 OK in 142ms (Views: 141.7ms | ActiveRecord: 0.1ms)
2186
+  (0.5ms) rollback transaction
2187
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
2188
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
2189
+  (0.1ms) begin transaction
2190
+  (0.0ms) SAVEPOINT active_record_1
2191
+ User Exists (0.1ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = 'dcox@linklinks.info' LIMIT 1
2192
+ SQL (1.7ms) INSERT INTO "users" ("age", "email", "password") VALUES (?, ?, ?) [["age", 10], ["email", "dcox@linklinks.info"], ["password", "justo in"]]
2193
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2194
+ Processing by UsersController#index as HTML
2195
+ User Load (0.1ms) SELECT "users".* FROM "users"
2196
+ Rendered users/index.html.haml within layouts/application (8.5ms)
2197
+ Completed 200 OK in 108ms (Views: 107.2ms | ActiveRecord: 0.1ms)
2198
+  (6.7ms) rollback transaction
2199
+  (0.1ms) begin transaction
2200
+  (0.1ms) SAVEPOINT active_record_1
2201
+ User Exists (0.2ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = 'larmstrong@browsecat.net' LIMIT 1
2202
+ SQL (0.3ms) INSERT INTO "users" ("age", "email", "password") VALUES (?, ?, ?) [["age", 1], ["email", "larmstrong@browsecat.net"], ["password", "potenti cras"]]
2203
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2204
+ Processing by UsersController#update as HTML
2205
+ Parameters: {"user"=>{"email"=>"newemail@example.com"}, "id"=>"1"}
2206
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
2207
+  (0.0ms) SAVEPOINT active_record_1
2208
+ User Exists (0.1ms) SELECT 1 AS one FROM "users" WHERE ("users"."email" = 'newemail@example.com' AND "users"."id" != 1) LIMIT 1
2209
+ SQL (1.3ms) UPDATE "users" SET "email" = ? WHERE "users"."id" = 1 [["email", "newemail@example.com"]]
2210
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2211
+ Redirected to http://test.host/users/1
2212
+ Completed 302 Found in 5ms (ActiveRecord: 1.5ms)
2213
+  (0.6ms) rollback transaction
2214
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
2215
+  (0.1ms) begin transaction
2216
+  (0.0ms) SAVEPOINT active_record_1
2217
+ User Exists (0.1ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = 'rfisher@browsecat.com' LIMIT 1
2218
+ SQL (1.6ms) INSERT INTO "users" ("age", "email", "password") VALUES (?, ?, ?) [["age", 5], ["email", "rfisher@browsecat.com"], ["password", "congue risus"]]
2219
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2220
+ Processing by UsersController#update as HTML
2221
+ Parameters: {"user"=>{"email"=>"newemail@example.com"}, "id"=>"1"}
2222
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
2223
+  (0.0ms) SAVEPOINT active_record_1
2224
+ User Exists (0.1ms) SELECT 1 AS one FROM "users" WHERE ("users"."email" = 'newemail@example.com' AND "users"."id" != 1) LIMIT 1
2225
+ SQL (1.2ms) UPDATE "users" SET "email" = ? WHERE "users"."id" = 1 [["email", "newemail@example.com"]]
2226
+  (0.1ms) RELEASE SAVEPOINT active_record_1
2227
+ Redirected to http://test.host/users/1
2228
+ Completed 302 Found in 13ms (ActiveRecord: 1.5ms)
2229
+  (6.8ms) rollback transaction
2230
+  (0.1ms) begin transaction
2231
+  (0.1ms) SAVEPOINT active_record_1
2232
+ User Exists (0.2ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = 'cmartin@meezzy.gov' LIMIT 1
2233
+ SQL (0.3ms) INSERT INTO "users" ("age", "email", "password") VALUES (?, ?, ?) [["age", 2], ["email", "cmartin@meezzy.gov"], ["password", "ligula in"]]
2234
+  (0.1ms) RELEASE SAVEPOINT active_record_1
2235
+ Processing by UsersController#index as HTML
2236
+ User Load (0.1ms) SELECT "users".* FROM "users"
2237
+ Completed 200 OK in 108ms (Views: 107.9ms | ActiveRecord: 0.1ms)
2238
+  (0.5ms) rollback transaction
2239
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
2240
+  (0.1ms) begin transaction
2241
+  (0.0ms) SAVEPOINT active_record_1
2242
+ User Exists (0.1ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = 'jlynch@zooxo.mil' LIMIT 1
2243
+ SQL (1.6ms) INSERT INTO "users" ("age", "email", "password") VALUES (?, ?, ?) [["age", 1], ["email", "jlynch@zooxo.mil"], ["password", "dictumst morbi"]]
2244
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2245
+ Processing by UsersController#index as HTML
2246
+ User Load (0.1ms) SELECT "users".* FROM "users"
2247
+ Rendered users/index.html.haml within layouts/application (11.1ms)
2248
+ Completed 200 OK in 112ms (Views: 112.0ms | ActiveRecord: 0.1ms)
2249
+  (6.7ms) rollback transaction
2250
+  (0.1ms) begin transaction
2251
+  (0.1ms) SAVEPOINT active_record_1
2252
+ User Exists (0.2ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = 'mwatkins@thoughtbridge.biz' LIMIT 1
2253
+ SQL (0.3ms) INSERT INTO "users" ("age", "email", "password") VALUES (?, ?, ?) [["age", 8], ["email", "mwatkins@thoughtbridge.biz"], ["password", "ac diam"]]
2254
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2255
+ Processing by UsersController#update as HTML
2256
+ Parameters: {"user"=>{"email"=>"newemail@example.com"}, "id"=>"1"}
2257
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
2258
+  (0.0ms) SAVEPOINT active_record_1
2259
+ User Exists (0.1ms) SELECT 1 AS one FROM "users" WHERE ("users"."email" = 'newemail@example.com' AND "users"."id" != 1) LIMIT 1
2260
+ SQL (1.1ms) UPDATE "users" SET "email" = ? WHERE "users"."id" = 1 [["email", "newemail@example.com"]]
2261
+  (0.1ms) RELEASE SAVEPOINT active_record_1
2262
+ Redirected to http://test.host/users/1
2263
+ Completed 302 Found in 5ms (ActiveRecord: 1.4ms)
2264
+  (0.5ms) rollback transaction
2265
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
2266
+  (0.1ms) begin transaction
2267
+  (0.0ms) SAVEPOINT active_record_1
2268
+ User Exists (0.1ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = 'apayne@flashspan.edu' LIMIT 1
2269
+ SQL (1.7ms) INSERT INTO "users" ("age", "email", "password") VALUES (?, ?, ?) [["age", 0], ["email", "apayne@flashspan.edu"], ["password", "ut odio"]]
2270
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2271
+ Processing by UsersController#index as HTML
2272
+ User Load (0.1ms) SELECT "users".* FROM "users"
2273
+ Rendered users/index.html.haml within layouts/application (11.0ms)
2274
+ Completed 200 OK in 118ms (Views: 117.5ms | ActiveRecord: 0.1ms)
2275
+  (6.6ms) rollback transaction
2276
+  (0.1ms) begin transaction
2277
+  (0.0ms) SAVEPOINT active_record_1
2278
+ User Exists (0.1ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = 'sgonzales@omba.edu' LIMIT 1
2279
+ SQL (0.2ms) INSERT INTO "users" ("age", "email", "password") VALUES (?, ?, ?) [["age", 5], ["email", "sgonzales@omba.edu"], ["password", "semper est"]]
2280
+  (0.1ms) RELEASE SAVEPOINT active_record_1
2281
+ Processing by UsersController#update as HTML
2282
+ Parameters: {"user"=>{"email"=>"newemail@example.com"}, "id"=>"1"}
2283
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
2284
+  (0.0ms) SAVEPOINT active_record_1
2285
+ User Exists (0.1ms) SELECT 1 AS one FROM "users" WHERE ("users"."email" = 'newemail@example.com' AND "users"."id" != 1) LIMIT 1
2286
+ SQL (1.1ms) UPDATE "users" SET "email" = ? WHERE "users"."id" = 1 [["email", "newemail@example.com"]]
2287
+  (0.1ms) RELEASE SAVEPOINT active_record_1
2288
+ Redirected to http://test.host/users/1
2289
+ Completed 302 Found in 4ms (ActiveRecord: 1.3ms)
2290
+  (0.6ms) rollback transaction
2291
+  (0.0ms) begin transaction
2292
+  (0.0ms) rollback transaction
2293
+  (0.0ms) begin transaction
2294
+  (0.0ms) rollback transaction
2295
+  (0.1ms) begin transaction
2296
+ Processing by AwesomeTranslations::HandlersController#index as HTML
2297
+ Completed 200 OK in 113ms (Views: 112.3ms | ActiveRecord: 0.0ms)
2298
+  (0.1ms) rollback transaction
2299
+  (0.1ms) begin transaction
2300
+ Processing by AwesomeTranslations::HandlersController#show as HTML
2301
+ Parameters: {"id"=>"model_handler"}
2302
+ Completed 200 OK in 22ms (Views: 21.4ms | ActiveRecord: 0.0ms)
2303
+  (0.1ms) rollback transaction
2304
+  (0.0ms) begin transaction
2305
+  (0.0ms) rollback transaction
2306
+  (0.0ms) begin transaction
2307
+  (0.0ms) rollback transaction
2308
+  (0.0ms) begin transaction
2309
+  (0.0ms) rollback transaction
2310
+  (0.0ms) begin transaction
2311
+  (0.0ms) rollback transaction
2312
+  (0.0ms) begin transaction
2313
+  (0.0ms) rollback transaction
2314
+  (0.0ms) begin transaction
2315
+  (0.0ms) rollback transaction
2316
+  (0.0ms) begin transaction
2317
+  (0.0ms) rollback transaction
2318
+  (0.0ms) begin transaction
2319
+  (0.0ms) rollback transaction
2320
+  (0.0ms) begin transaction
2321
+  (0.1ms) rollback transaction
2322
+  (0.1ms) begin transaction
2323
+  (0.1ms) rollback transaction
2324
+  (0.1ms) begin transaction
2325
+  (0.1ms) rollback transaction
2326
+  (0.0ms) begin transaction
2327
+  (0.0ms) rollback transaction
2328
+  (0.0ms) begin transaction
2329
+  (0.0ms) rollback transaction
2330
+  (0.0ms) begin transaction
2331
+  (0.0ms) rollback transaction
2332
+  (0.0ms) begin transaction
2333
+  (0.0ms) rollback transaction
2334
+  (0.0ms) begin transaction
2335
+  (0.0ms) rollback transaction
2336
+  (0.0ms) begin transaction
2337
+  (0.0ms) rollback transaction
2338
+  (0.0ms) begin transaction
2339
+  (0.1ms) rollback transaction
2340
+  (0.1ms) begin transaction
2341
+  (0.1ms) rollback transaction
2342
+  (0.0ms) begin transaction
2343
+  (0.1ms) rollback transaction
2344
+  (0.1ms) begin transaction
2345
+  (0.1ms) rollback transaction
2346
+  (0.0ms) begin transaction
2347
+  (0.0ms) rollback transaction
2348
+  (0.0ms) begin transaction
2349
+  (0.0ms) rollback transaction
2350
+  (0.0ms) begin transaction
2351
+  (0.0ms) rollback transaction
2352
+  (0.0ms) begin transaction
2353
+  (0.0ms) rollback transaction
2354
+  (0.0ms) begin transaction
2355
+  (0.0ms) rollback transaction
2356
+  (0.0ms) begin transaction
2357
+  (0.1ms) rollback transaction
2358
+  (0.0ms) begin transaction
2359
+  (0.0ms) rollback transaction
2360
+  (0.0ms) begin transaction
2361
+  (0.0ms) rollback transaction
2362
+  (0.0ms) begin transaction
2363
+  (0.0ms) rollback transaction
2364
+  (0.0ms) begin transaction
2365
+  (0.0ms) rollback transaction
2366
+  (0.0ms) begin transaction
2367
+ Processing by AwesomeTranslations::GroupsController#update as HTML
2368
+ Parameters: {"handler_id"=>"rails_handler", "id"=>"date_time", "t"=>{"date.day_names"=>{"1"=>{"da"=>"Mandag"}, "4"=>{"da"=>"Torsdag"}}}}
2369
+ Redirected to http://test.host/handlers/rails_handler/groups/date_time
2370
+ Completed 302 Found in 6ms (ActiveRecord: 0.0ms)
2371
+  (0.1ms) rollback transaction
2372
+  (0.0ms) begin transaction
2373
+ Processing by AwesomeTranslations::GroupsController#update as HTML
2374
+ Parameters: {"handler_id"=>"model_handler", "id"=>"User", "t"=>{"activerecord.attributes.user.password"=>"[FILTERED]"}}
2375
+ Redirected to http://test.host/handlers/model_handler/groups/User
2376
+ Completed 302 Found in 12ms (ActiveRecord: 0.0ms)
2377
+  (0.1ms) rollback transaction
2378
+  (0.0ms) begin transaction
2379
+ Processing by AwesomeTranslations::GroupsController#update as HTML
2380
+ Parameters: {"handler_id"=>"model_handler", "id"=>"Role", "t"=>{"activerecord.attributes.role.role"=>{"da"=>"Rolle", "de"=>"Die type", "en"=>"Role"}}}
2381
+ Redirected to http://test.host/handlers/model_handler/groups/Role
2382
+ Completed 302 Found in 47ms (ActiveRecord: 0.0ms)
2383
+  (0.1ms) rollback transaction
2384
+  (0.0ms) begin transaction
2385
+  (0.0ms) rollback transaction
2386
+  (0.0ms) begin transaction
2387
+  (0.0ms) rollback transaction
2388
+  (0.0ms) begin transaction
2389
+  (0.0ms) rollback transaction
2390
+  (0.0ms) begin transaction
2391
+  (0.0ms) rollback transaction
2392
+  (0.0ms) begin transaction
2393
+  (0.0ms) rollback transaction
2394
+  (0.1ms) begin transaction
2395
+  (0.1ms) rollback transaction
2396
+  (0.1ms) begin transaction
2397
+  (0.0ms) rollback transaction
2398
+  (0.0ms) begin transaction
2399
+  (0.1ms) rollback transaction
2400
+  (0.0ms) begin transaction
2401
+  (0.1ms) rollback transaction
2402
+  (0.1ms) begin transaction
2403
+  (0.0ms) rollback transaction
2404
+  (0.0ms) begin transaction
2405
+  (0.0ms) rollback transaction
2406
+  (0.0ms) begin transaction
2407
+  (0.0ms) rollback transaction
2408
+  (0.0ms) begin transaction
2409
+  (0.0ms) rollback transaction
2410
+  (0.0ms) begin transaction
2411
+  (0.0ms) rollback transaction
2412
+  (0.0ms) begin transaction
2413
+  (0.0ms) rollback transaction
2414
+  (0.0ms) begin transaction
2415
+  (0.1ms) rollback transaction
2416
+  (0.0ms) begin transaction
2417
+  (0.1ms) rollback transaction
2418
+  (0.0ms) begin transaction
2419
+  (0.0ms) rollback transaction
2420
+  (0.0ms) begin transaction
2421
+  (0.0ms) rollback transaction
2422
+  (0.0ms) begin transaction
2423
+  (0.1ms) rollback transaction
2424
+  (0.0ms) begin transaction
2425
+  (0.0ms) rollback transaction
2426
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
2427
+  (0.1ms) begin transaction
2428
+  (0.0ms) rollback transaction
2429
+  (0.0ms) begin transaction
2430
+  (0.1ms) rollback transaction
2431
+  (0.1ms) begin transaction
2432
+  (0.0ms) rollback transaction
2433
+  (0.0ms) begin transaction
2434
+  (0.0ms) rollback transaction
2435
+  (0.0ms) begin transaction
2436
+ Processing by AwesomeTranslations::HandlersController#show as HTML
2437
+ Parameters: {"id"=>"model_handler"}
2438
+ Rendered /Users/kaspernj/Dev/Rails/awesome_translations/app/views/awesome_translations/handlers/show.html.haml within layouts/awesome_translations/application (19.0ms)
2439
+ Completed 200 OK in 240ms (Views: 239.8ms | ActiveRecord: 0.0ms)
2440
+  (0.1ms) rollback transaction
2441
+  (0.1ms) begin transaction
2442
+ Processing by AwesomeTranslations::HandlersController#index as HTML
2443
+ Completed 200 OK in 4ms (Views: 3.6ms | ActiveRecord: 0.0ms)
2444
+  (0.0ms) rollback transaction
2445
+  (0.0ms) begin transaction
2446
+  (0.1ms) rollback transaction
2447
+  (0.1ms) begin transaction
2448
+  (0.1ms) rollback transaction
2449
+  (0.0ms) begin transaction
2450
+  (0.1ms) rollback transaction
2451
+  (0.0ms) begin transaction
2452
+  (0.0ms) rollback transaction
2453
+  (0.0ms) begin transaction
2454
+  (0.0ms) rollback transaction
2455
+  (0.0ms) begin transaction
2456
+  (0.0ms) rollback transaction
2457
+  (0.0ms) begin transaction
2458
+  (0.0ms) rollback transaction
2459
+  (0.0ms) begin transaction
2460
+  (0.0ms) rollback transaction
2461
+  (0.0ms) begin transaction
2462
+  (0.0ms) rollback transaction
2463
+  (0.0ms) begin transaction
2464
+  (0.0ms) rollback transaction
2465
+  (0.0ms) begin transaction
2466
+  (0.0ms) rollback transaction
2467
+  (0.0ms) begin transaction
2468
+  (0.0ms) rollback transaction
2469
+  (0.0ms) begin transaction
2470
+  (0.0ms) rollback transaction
2471
+  (0.0ms) begin transaction
2472
+  (0.0ms) rollback transaction
2473
+  (0.0ms) begin transaction
2474
+  (0.1ms) rollback transaction
2475
+  (0.0ms) begin transaction
2476
+  (0.0ms) rollback transaction
2477
+  (0.0ms) begin transaction
2478
+  (0.0ms) rollback transaction
2479
+  (0.0ms) begin transaction
2480
+  (0.0ms) rollback transaction
2481
+  (0.0ms) begin transaction
2482
+  (0.0ms) rollback transaction
2483
+  (0.0ms) begin transaction
2484
+  (0.0ms) rollback transaction
2485
+  (0.0ms) begin transaction
2486
+  (0.0ms) rollback transaction
2487
+  (0.0ms) begin transaction
2488
+  (0.0ms) rollback transaction
2489
+  (0.0ms) begin transaction
2490
+  (0.0ms) rollback transaction
2491
+  (0.0ms) begin transaction
2492
+  (0.0ms) rollback transaction
2493
+  (0.0ms) begin transaction
2494
+  (0.0ms) rollback transaction
2495
+  (0.0ms) begin transaction
2496
+  (0.0ms) rollback transaction
2497
+  (0.0ms) begin transaction
2498
+  (0.0ms) rollback transaction
2499
+  (0.0ms) begin transaction
2500
+  (0.0ms) rollback transaction
2501
+  (0.0ms) begin transaction
2502
+  (0.0ms) rollback transaction
2503
+  (0.0ms) begin transaction
2504
+ Processing by AwesomeTranslations::GroupsController#update as HTML
2505
+ Parameters: {"handler_id"=>"model_handler", "id"=>"Role", "t"=>{"activerecord.attributes.role.role"=>{"da"=>"Rolle", "de"=>"Die type", "en"=>"Role"}}}
2506
+ Redirected to http://test.host/handlers/model_handler/groups/Role
2507
+ Completed 302 Found in 4ms (ActiveRecord: 0.0ms)
2508
+  (0.0ms) rollback transaction
2509
+  (0.0ms) begin transaction
2510
+ Processing by AwesomeTranslations::GroupsController#update as HTML
2511
+ Parameters: {"handler_id"=>"rails_handler", "id"=>"date_time", "t"=>{"date.day_names"=>{"1"=>{"da"=>"Mandag"}, "4"=>{"da"=>"Torsdag"}}}}
2512
+ Redirected to http://test.host/handlers/rails_handler/groups/date_time
2513
+ Completed 302 Found in 39ms (ActiveRecord: 0.0ms)
2514
+  (0.1ms) rollback transaction
2515
+  (0.0ms) begin transaction
2516
+ Processing by AwesomeTranslations::GroupsController#update as HTML
2517
+ Parameters: {"handler_id"=>"model_handler", "id"=>"User", "t"=>{"activerecord.attributes.user.password"=>"[FILTERED]"}}
2518
+ Redirected to http://test.host/handlers/model_handler/groups/User
2519
+ Completed 302 Found in 11ms (ActiveRecord: 0.0ms)
2520
+  (0.1ms) rollback transaction
2521
+  (0.0ms) begin transaction
2522
+  (0.0ms) rollback transaction
2523
+  (0.0ms) begin transaction
2524
+  (0.1ms) rollback transaction
2525
+  (0.0ms) begin transaction
2526
+  (0.0ms) rollback transaction
2527
+  (0.0ms) begin transaction
2528
+  (0.0ms) rollback transaction
2529
+  (0.0ms) begin transaction
2530
+  (0.0ms) rollback transaction
2531
+  (0.0ms) begin transaction
2532
+  (0.0ms) rollback transaction
2533
+  (0.0ms) begin transaction
2534
+  (0.0ms) rollback transaction
2535
+  (0.0ms) begin transaction
2536
+  (0.0ms) rollback transaction
2537
+  (0.0ms) begin transaction
2538
+  (0.0ms) rollback transaction
2539
+  (0.0ms) begin transaction
2540
+  (0.0ms) rollback transaction
2541
+  (0.0ms) begin transaction
2542
+  (0.0ms) rollback transaction
2543
+  (0.0ms) begin transaction
2544
+  (0.0ms) rollback transaction
2545
+  (0.0ms) begin transaction
2546
+  (0.0ms) rollback transaction
2547
+  (0.0ms) begin transaction
2548
+  (0.0ms) rollback transaction
2549
+  (0.0ms) begin transaction
2550
+  (0.0ms) rollback transaction
2551
+  (0.0ms) begin transaction
2552
+  (0.0ms) rollback transaction
2553
+  (0.0ms) begin transaction
2554
+  (0.0ms) rollback transaction
2555
+  (0.0ms) begin transaction
2556
+  (0.1ms) rollback transaction
2557
+  (0.1ms) begin transaction
2558
+  (0.0ms) rollback transaction
2559
+  (0.0ms) begin transaction
2560
+  (0.0ms) rollback transaction
2561
+  (0.0ms) begin transaction
2562
+  (0.0ms) rollback transaction
2563
+  (0.0ms) begin transaction
2564
+  (0.0ms) SAVEPOINT active_record_1
2565
+ User Exists (0.1ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = 'jperkins@browsebug.mil' LIMIT 1
2566
+ SQL (1.6ms) INSERT INTO "users" ("age", "email", "password") VALUES (?, ?, ?) [["age", 8], ["email", "jperkins@browsebug.mil"], ["password", "adipiscing lorem"]]
2567
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2568
+ Processing by UsersController#update as HTML
2569
+ Parameters: {"user"=>{"email"=>"newemail@example.com"}, "id"=>"1"}
2570
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
2571
+  (0.1ms) SAVEPOINT active_record_1
2572
+ User Exists (0.1ms) SELECT 1 AS one FROM "users" WHERE ("users"."email" = 'newemail@example.com' AND "users"."id" != 1) LIMIT 1
2573
+ SQL (1.2ms) UPDATE "users" SET "email" = ? WHERE "users"."id" = 1 [["email", "newemail@example.com"]]
2574
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2575
+ Redirected to http://test.host/users/1
2576
+ Completed 302 Found in 4ms (ActiveRecord: 1.4ms)
2577
+  (0.6ms) rollback transaction
2578
+  (0.0ms) begin transaction
2579
+  (0.1ms) SAVEPOINT active_record_1
2580
+ User Exists (0.1ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = 'awebb@brainlounge.gov' LIMIT 1
2581
+ SQL (0.2ms) INSERT INTO "users" ("age", "email", "password") VALUES (?, ?, ?) [["age", 2], ["email", "awebb@brainlounge.gov"], ["password", "sit amet"]]
2582
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2583
+ Processing by UsersController#index as HTML
2584
+ User Load (0.1ms) SELECT "users".* FROM "users"
2585
+ Completed 200 OK in 15ms (Views: 14.4ms | ActiveRecord: 0.1ms)
2586
+  (0.4ms) rollback transaction
2587
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
2588
+  (0.1ms) begin transaction
2589
+  (0.1ms) rollback transaction
2590
+  (0.1ms) begin transaction
2591
+  (0.1ms) rollback transaction
2592
+  (0.0ms) begin transaction
2593
+  (0.0ms) rollback transaction
2594
+  (0.1ms) begin transaction
2595
+  (0.0ms) rollback transaction
2596
+  (0.0ms) begin transaction
2597
+  (0.0ms) rollback transaction
2598
+  (0.0ms) begin transaction
2599
+  (0.0ms) rollback transaction
2600
+  (0.0ms) begin transaction
2601
+ Processing by AwesomeTranslations::HandlersController#show as HTML
2602
+ Parameters: {"id"=>"model_handler"}
2603
+ Rendered /Users/kaspernj/Dev/Rails/awesome_translations/app/views/awesome_translations/handlers/show.html.haml within layouts/awesome_translations/application (28.3ms)
2604
+ Completed 200 OK in 231ms (Views: 230.5ms | ActiveRecord: 0.0ms)
2605
+  (0.1ms) rollback transaction
2606
+  (0.0ms) begin transaction
2607
+ Processing by AwesomeTranslations::HandlersController#index as HTML
2608
+ Completed 200 OK in 4ms (Views: 3.7ms | ActiveRecord: 0.0ms)
2609
+  (0.0ms) rollback transaction
2610
+  (0.0ms) begin transaction
2611
+  (0.1ms) rollback transaction
2612
+  (0.0ms) begin transaction
2613
+  (0.1ms) rollback transaction
2614
+  (0.0ms) begin transaction
2615
+  (0.1ms) rollback transaction
2616
+  (0.0ms) begin transaction
2617
+  (0.0ms) rollback transaction
2618
+  (0.0ms) begin transaction
2619
+  (0.0ms) rollback transaction
2620
+  (0.0ms) begin transaction
2621
+  (0.0ms) rollback transaction
2622
+  (0.0ms) begin transaction
2623
+  (0.0ms) rollback transaction
2624
+  (0.0ms) begin transaction
2625
+  (0.0ms) rollback transaction
2626
+  (0.0ms) begin transaction
2627
+  (0.0ms) rollback transaction
2628
+  (0.0ms) begin transaction
2629
+  (0.0ms) rollback transaction
2630
+  (0.0ms) begin transaction
2631
+  (0.0ms) rollback transaction
2632
+  (0.0ms) begin transaction
2633
+  (0.0ms) rollback transaction
2634
+  (0.0ms) begin transaction
2635
+  (0.0ms) rollback transaction
2636
+  (0.0ms) begin transaction
2637
+  (0.0ms) rollback transaction
2638
+  (0.0ms) begin transaction
2639
+  (0.0ms) rollback transaction
2640
+  (0.0ms) begin transaction
2641
+  (0.0ms) rollback transaction
2642
+  (0.0ms) begin transaction
2643
+  (0.0ms) rollback transaction
2644
+  (0.0ms) begin transaction
2645
+  (0.0ms) rollback transaction
2646
+  (0.0ms) begin transaction
2647
+  (0.0ms) rollback transaction
2648
+  (0.0ms) begin transaction
2649
+  (0.1ms) rollback transaction
2650
+  (0.1ms) begin transaction
2651
+  (0.1ms) rollback transaction
2652
+  (0.1ms) begin transaction
2653
+  (0.0ms) rollback transaction
2654
+  (0.0ms) begin transaction
2655
+  (0.0ms) rollback transaction
2656
+  (0.0ms) begin transaction
2657
+  (0.0ms) rollback transaction
2658
+  (0.0ms) begin transaction
2659
+  (0.0ms) rollback transaction
2660
+  (0.0ms) begin transaction
2661
+  (0.0ms) rollback transaction
2662
+  (0.0ms) begin transaction
2663
+  (0.0ms) rollback transaction
2664
+  (0.0ms) begin transaction
2665
+  (0.0ms) SAVEPOINT active_record_1
2666
+ User Exists (0.1ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = 'manderson@gevee.mil' LIMIT 1
2667
+ SQL (1.5ms) INSERT INTO "users" ("age", "email", "password") VALUES (?, ?, ?) [["age", 1], ["email", "manderson@gevee.mil"], ["password", "morbi a"]]
2668
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2669
+ Processing by UsersController#update as HTML
2670
+ Parameters: {"user"=>{"email"=>"newemail@example.com"}, "id"=>"1"}
2671
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
2672
+  (0.0ms) SAVEPOINT active_record_1
2673
+ User Exists (0.1ms) SELECT 1 AS one FROM "users" WHERE ("users"."email" = 'newemail@example.com' AND "users"."id" != 1) LIMIT 1
2674
+ SQL (1.2ms) UPDATE "users" SET "email" = ? WHERE "users"."id" = 1 [["email", "newemail@example.com"]]
2675
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2676
+ Redirected to http://test.host/users/1
2677
+ Completed 302 Found in 5ms (ActiveRecord: 1.4ms)
2678
+  (0.7ms) rollback transaction
2679
+  (0.0ms) begin transaction
2680
+  (0.0ms) SAVEPOINT active_record_1
2681
+ User Exists (0.1ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = 'hrobinson@avamba.name' LIMIT 1
2682
+ SQL (0.2ms) INSERT INTO "users" ("age", "email", "password") VALUES (?, ?, ?) [["age", 2], ["email", "hrobinson@avamba.name"], ["password", "nibh fusce"]]
2683
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2684
+ Processing by UsersController#index as HTML
2685
+ User Load (0.1ms) SELECT "users".* FROM "users"
2686
+ Completed 200 OK in 22ms (Views: 21.6ms | ActiveRecord: 0.1ms)
2687
+  (0.4ms) rollback transaction
2688
+  (0.0ms) begin transaction
2689
+  (0.0ms) rollback transaction
2690
+  (0.0ms) begin transaction
2691
+  (0.0ms) rollback transaction
2692
+  (0.0ms) begin transaction
2693
+  (0.1ms) rollback transaction
2694
+  (0.0ms) begin transaction
2695
+  (0.0ms) rollback transaction
2696
+  (0.1ms) begin transaction
2697
+  (0.1ms) rollback transaction
2698
+  (0.1ms) begin transaction
2699
+  (0.0ms) rollback transaction
2700
+  (0.0ms) begin transaction
2701
+  (0.0ms) rollback transaction
2702
+  (0.0ms) begin transaction
2703
+  (0.0ms) rollback transaction
2704
+  (0.1ms) begin transaction
2705
+  (0.0ms) rollback transaction
2706
+  (0.0ms) begin transaction
2707
+  (0.0ms) rollback transaction
2708
+  (0.0ms) begin transaction
2709
+  (0.0ms) rollback transaction
2710
+  (0.0ms) begin transaction
2711
+  (0.1ms) rollback transaction
2712
+  (0.0ms) begin transaction
2713
+  (0.0ms) rollback transaction
2714
+  (0.0ms) begin transaction
2715
+ Processing by AwesomeTranslations::GroupsController#update as HTML
2716
+ Parameters: {"handler_id"=>"rails_handler", "id"=>"date_time", "t"=>{"date.day_names"=>{"1"=>{"da"=>"Mandag"}, "4"=>{"da"=>"Torsdag"}}}}
2717
+ Redirected to http://test.host/handlers/rails_handler/groups/date_time
2718
+ Completed 302 Found in 6ms (ActiveRecord: 0.0ms)
2719
+  (0.1ms) rollback transaction
2720
+  (0.1ms) begin transaction
2721
+ Processing by AwesomeTranslations::GroupsController#update as HTML
2722
+ Parameters: {"handler_id"=>"model_handler", "id"=>"Role", "t"=>{"activerecord.attributes.role.role"=>{"da"=>"Rolle", "de"=>"Die type", "en"=>"Role"}}}
2723
+ Redirected to http://test.host/handlers/model_handler/groups/Role
2724
+ Completed 302 Found in 13ms (ActiveRecord: 0.0ms)
2725
+  (0.0ms) rollback transaction
2726
+  (0.0ms) begin transaction
2727
+ Processing by AwesomeTranslations::GroupsController#update as HTML
2728
+ Parameters: {"handler_id"=>"model_handler", "id"=>"User", "t"=>{"activerecord.attributes.user.password"=>"[FILTERED]"}}
2729
+ Redirected to http://test.host/handlers/model_handler/groups/User
2730
+ Completed 302 Found in 10ms (ActiveRecord: 0.0ms)
2731
+  (0.1ms) rollback transaction
2732
+  (0.0ms) begin transaction
2733
+  (0.0ms) rollback transaction
2734
+  (0.0ms) begin transaction
2735
+  (0.1ms) rollback transaction
2736
+  (0.1ms) begin transaction
2737
+  (0.0ms) rollback transaction
2738
+  (0.0ms) begin transaction
2739
+  (0.0ms) rollback transaction
2740
+  (0.1ms) begin transaction
2741
+  (0.1ms) rollback transaction
2742
+  (0.1ms) begin transaction
2743
+  (0.0ms) rollback transaction
2744
+  (0.0ms) begin transaction
2745
+  (0.0ms) rollback transaction
2746
+  (0.0ms) begin transaction
2747
+  (0.0ms) rollback transaction
@@ -10,26 +10,26 @@ describe AwesomeTranslations::Handlers::ErbHandler do
10
10
 
11
11
  it "finds translations made with the t method" do
12
12
  hello_world_translations = users_index_translations.select { |t| t.key == "users.index.hello_world" }
13
- hello_world_translations.length.should eq 1
13
+ hello_world_translations.to_a.length.should eq 1
14
14
  end
15
15
 
16
16
  it "finds translations in the layout" do
17
17
  danish_translations = layout_translations.select { |t| t.key == "layouts.application.danish" }
18
- danish_translations.length.should eq 1
18
+ danish_translations.to_a.length.should eq 1
19
19
  end
20
20
 
21
21
  it "doesnt include _ in partial keys" do
22
22
  partial_test = users_partial_test_translations.select { |t| t.key == "users.partial_test.partial_test" }
23
- partial_test.length.should eq 1
23
+ partial_test.to_a.length.should eq 1
24
24
  end
25
25
 
26
26
  it "removes special characters when using the custom method" do
27
27
  current_language_translation = layout_translations.select { |t| t.key == "layouts.application.the_current_language_is" }
28
- current_language_translation.length.should eq 1
28
+ current_language_translation.to_a.length.should eq 1
29
29
  end
30
30
 
31
31
  it "has unique translations" do
32
- expect(layout_translations.select { |t| t.key == "layouts.application.hello_world" }.length).to eq 1
32
+ expect(layout_translations.select { |t| t.key == "layouts.application.hello_world" }.to_a.length).to eq 1
33
33
  end
34
34
 
35
35
  it "sets the correct translation path" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awesome_translations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.21
4
+ version: 0.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kasper Johansen
@@ -228,6 +228,7 @@ files:
228
228
  - config/routes.rb
229
229
  - lib/awesome_translations.rb
230
230
  - lib/awesome_translations/config.rb
231
+ - lib/awesome_translations/controller_translate_functionality.rb
231
232
  - lib/awesome_translations/engine.rb
232
233
  - lib/awesome_translations/erb_inspector.rb
233
234
  - lib/awesome_translations/erb_inspector/file_inspector.rb