Sha256: b0cff6c7528904978efbd48bdcbc5309093382ad7ef38055d674290c69a4c565

Contents?: true

Size: 916 Bytes

Versions: 6

Compression:

Stored size: 916 Bytes

Contents

namespace "db" do
  namespace "seed" do
    desc "Seed initial rights to each role"
    task :rights => :environment do
      load "#{Rails.root}/db/fixtures/rights_roles.rb" 
    end

    namespace "rights" do
      desc "Remove existing rights data and reinitiate it with seeds."
      task :redo => :environment do
        message = []
        message << "This rake task will delete all existing rights and reload Roles with the default rights"
        message << "Every roles will lose their existing rights unless specified in db/fixtures/rights_roles.yml"

        RakeUserInterface.confirmation_required(message) do
          RightOn::Right.transaction do
            if RightOn::Right.count > 0
              puts "Removing existing Right data..."
              RightOn::Right.destroy_all
            end

            Rake::Task["db:seed:rights"].invoke
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
right_on-1.0.0 lib/right_on/tasks/seeds_rights.rake
right_on-0.4.1 lib/right_on/tasks/seeds_rights.rake
right_on-0.4.0 lib/right_on/tasks/seeds_rights.rake
right_on-0.3.0 lib/right_on/tasks/seeds_rights.rake
right_on-0.2.0 lib/right_on/tasks/seeds_rights.rake
right_on-0.1.0 lib/right_on/tasks/seeds_rights.rake