Class: Chive::Generators::SeedsGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/chive/seeds_generator.rb

Instance Method Summary collapse

Instance Method Details

#manifestObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/generators/chive/seeds_generator.rb', line 14

def manifest
  append_to_file 'db/seeds.rb' do
    "\n# Chive examples\nif Rails.env.development?\n  user = \#{options[:user].camelize}.create(name: 'Example', email: '[email protected]', password: 'password')\n  Chive::\#{options[:article].camelize}.create(\n    title: 'Hello, World!',\n    body: %(\n<p>This is an example article created by the development seeds (db/seeds.rb).</p>\n    ),\n    author: user,\n    status: 'publish',\n    published_at: DateTime.now\n  )\nend\n    RUBY\n  end\nend\n"