Sha256: be3162ea48ff092d60c1ecb43fe88fd8afbbc664b53008f76b8dd6e9d2816a49

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

namespace :georgia do

  desc "Creates an Admin user to get started"
  task seed: :environment do
    first_name = ask("First name:")
    last_name = ask("Last name:")
    email = ask("Email:")
    password = ask("Password:")
    Georgia::User.create(first_name: first_name, last_name: last_name, email: email, password: password, password_confirmation: password) do |user|
      user.roles << Georgia::Role.all
    end
  end

  namespace :messages do

    desc "Send to Akismet all unverified messages"
    task verify: :environment do
      puts "Check for spam. Currently have #{Georgia::Message.spam.count} spam and #{Georgia::Message.ham.count} ham messages."
      puts "Checking #{Georgia::Message.where(verified_at: nil).count} unverified messages."
      Georgia::Message.where(verified_at: nil).find_each do |message|
        message.update_attributes(spam: message.spam?, verified_at: Time.zone.now)
      end
      puts "Check completed. #{Georgia::Message.spam.count} spam. #{Georgia::Message.ham.count} ham."
    end

  end


end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
georgia-0.7.5 lib/tasks/georgia.rake
georgia-0.7.4 lib/tasks/georgia.rake
georgia-0.7.3 lib/tasks/georgia.rake
georgia-0.7.2 lib/tasks/georgia.rake