Created
February 23, 2011 10:56
-
-
Save riyad/840286 to your computer and use it in GitHub Desktop.
How to setup your Rails app for using the declarative_authorization gem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
protect_from_forgery | |
before_filter :set_current_user | |
protected | |
# neccessary for declarative_authorization model permissions | |
def set_current_user | |
# current_user should be defined somewhere as the logged in used | |
Authorization.current_user = current_user | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'http://rubygems.org' | |
gem 'rails', '3.0.3' | |
... | |
gem 'declarative_authorization' | |
group :development do | |
# for the graphical overview over your rules | |
# available at /authorization_rules | |
# you will also need to install dot/graphviz for the graph generation | |
gem 'ruby_parser' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file is copied to spec/ when you run 'rails generate rspec:install' | |
ENV["RAILS_ENV"] ||= 'test' | |
require File.expand_path("../../config/environment", __FILE__) | |
require 'rspec/rails' | |
... | |
require 'declarative_authorization/maintenance' | |
include Authorization::TestHelper | |
... | |
RSpec.configure do |config| | |
... | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment