Skip to content

Commit

Permalink
Fix template for Rails 5
Browse files Browse the repository at this point in the history
  • Loading branch information
jensljungblad committed Jul 12, 2016
1 parent 04d98a2 commit 95e0a79
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions template.rb
Expand Up @@ -4,7 +4,10 @@ def install_standalone
gem "godmin", "1.3.0"

after_bundle do
generate_model
create_database

generate_models

generate("godmin:install")
generate("godmin:resource", "article")
generate("godmin:resource", "author")
Expand Down Expand Up @@ -36,7 +39,8 @@ def install_engine
gem "admin", path: "admin"

after_bundle do
generate_model
generate_models

run_ruby_script("admin/bin/rails g godmin:install")
run_ruby_script("admin/bin/rails g godmin:resource article")
run_ruby_script("admin/bin/rails g godmin:resource author")
Expand All @@ -59,7 +63,12 @@ def install_engine
end
end

def generate_model
def create_database
rake("db:drop")
rake("db:create")
end

def generate_models
generate(:model, "author name:string")
generate(:model, "article title:string body:text author:references published:boolean published_at:datetime")

Expand Down Expand Up @@ -285,9 +294,8 @@ def batch_action_destroy(authors)
END
end
end

def migrate_and_seed
rake("db:drop")
rake("db:create")
rake("db:migrate")
rake("db:seed")
end
Expand Down

0 comments on commit 95e0a79

Please sign in to comment.