lib/generators/scrivito/widget/widget_generator.rb in scrivito_sdk-0.30.0.rc1 vs lib/generators/scrivito/widget/widget_generator.rb in scrivito_sdk-0.30.0
- old
+ new
@@ -4,28 +4,25 @@
include ::Rails::Generators::Migration
source_root File.expand_path('../templates', __FILE__)
def self.next_migration_number(dirname)
- max = current_migration_number(dirname)
- Scrivito::Migration.next_migration_number(max)
+ Scrivito::Migration.next_migration_number(current_migration_number(dirname))
end
- def generate_model
- template('model.erb', "app/models/#{file_name}.rb")
+ def create_model
+ template 'model.erb', "app/models/#{file_name}.rb"
end
- def generate_views
- path = "app/views/#{file_name}"
-
- template('show.html.erb', "#{path}/show.html.erb")
- template('details.html.erb', "#{path}/details.html.erb")
- template('thumbnail.html.erb', "#{path}/thumbnail.html.erb")
+ def create_views
+ template 'show.html.erb', "app/views/#{file_name}/show.html.erb"
+ template 'details.html.erb', "app/views/#{file_name}/details.html.erb"
+ template 'thumbnail.html.erb', "app/views/#{file_name}/thumbnail.html.erb"
end
def generate_migration
- base_path = Scrivito::Configuration.migration_path
- migration_template('migration.erb', File.join(base_path, "/create_#{file_name}.rb"))
+ migration_template 'migration.erb',
+ File.join(Scrivito::Configuration.migration_path, "create_#{file_name}_migration.rb")
end
end
end
end