class Chive::Generators::SeedsGenerator

Public Instance Methods

manifest() click to toggle source
# File lib/generators/chive/seeds_generator.rb, line 14
      def manifest
        append_to_file 'db/seeds.rb' do
          <<-RUBY

# Chive examples
if Rails.env.development?
  user = #{options[:user].camelize}.create(name: 'Example', email: 'example@example.com', password: 'password')
  Chive::#{options[:article].camelize}.create(
    title: 'Hello, World!',
    body: %(
      <p>This is an example article created by the development seeds (db/seeds.rb).</p>
    ),
    author: user,
    status: 'published',
    published_at: DateTime.now
  )
end
          RUBY
        end
      end