Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
foxinator-generator (0.0.18)
foxinator-generator (0.0.19)
bootstrap-kaminari-views (~> 0.0.5)
devise (~> 3.4.1)
inherited_resources (~> 1.6.0)
Expand Down Expand Up @@ -162,3 +162,6 @@ DEPENDENCIES
rdoc (~> 3.12)
shoulda
simplecov

BUNDLED WITH
1.10.2
3 changes: 2 additions & 1 deletion lib/generators/foxinator/scaffold/model_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def self.next_migration_number(dirname)
end

def create_model
migration_template 'migration.rb', "db/migrate/create_#{file_name.pluralize}.rb"
table_name = class_name.tableize.parameterize('_')
migration_template 'migration.rb', "db/migrate/create_#{table_name}.rb"
template 'model.rb', "app/models/#{file_name.singularize}.rb"
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/generators/foxinator/scaffold/templates/migration.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Create<%= class_name.pluralize %> < ActiveRecord::Migration
class Create<%= class_name.gsub('::','').pluralize %> < ActiveRecord::Migration

def change
create_table :<%= file_name.pluralize %> do |t|
create_table :<%= table_name %> do |t|
<%- model_attrs.each do |attr| -%>
t.<%= attr.type %> :<%= attr.name %>
<%- end -%>
Expand Down