localized_scaffold 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -266,11 +266,7 @@ class <%= controller_class_name %>Controller < ApplicationController
266
266
  # Before filter setting up @<%= file_name %> needed by most actions.
267
267
 
268
268
  def setup_<%= file_name %>
269
- <%- if has_belongsto? -%>
270
- @<%= file_name %> = @<%= belongsto.file_name %>.<%= table_name %>.find(params[:id])
271
- <%- else -%>
272
269
  @<%= file_name %> = <%= class_name %>.find(params[:id])
273
- <%- end -%>
274
270
 
275
271
  if @<%= file_name %>.nil?
276
272
  flash[:error] = t('<%= file_name %>.errors.not_found')
@@ -283,6 +279,10 @@ class <%= controller_class_name %>Controller < ApplicationController
283
279
 
284
280
  return false
285
281
  end
282
+ <%- if has_belongsto? -%>
283
+
284
+ @<%= belongsto.file_name %> = @<%= file_name %>.<%= belongsto.file_name %>
285
+ <%- end -%>
286
286
 
287
287
  return true
288
288
  end
@@ -292,6 +292,8 @@ class <%= controller_class_name %>Controller < ApplicationController
292
292
  # needed by most actions.
293
293
 
294
294
  def setup_<%= belongsto.file_name %>
295
+ return if params[:<%= belongsto.file_name %>_id].blank?
296
+
295
297
  @<%= belongsto.file_name %> = <%= belongsto.class_name %>.find(params[:<%= belongsto.file_name %>_id])
296
298
 
297
299
  if @<%= belongsto.file_name %>.nil?
@@ -19,7 +19,7 @@ namespace :localized_scaffold do
19
19
  puts 'Done'
20
20
  end
21
21
 
22
- desc 'Adds i18n config to Rails::Initializer section of environment.rb.'
22
+ desc 'Adds i18n config to Rails::Initializer section of application.rb.'
23
23
  task :configure => [:environment] do
24
24
  patch = <<EOF
25
25
  config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '*.{rb,yml}')]
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 9
8
- - 2
9
- version: 0.9.2
8
+ - 3
9
+ version: 0.9.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jan Ulbrich
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-31 00:00:00 +02:00
17
+ date: 2010-06-15 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies: []
20
20