This file contains hidden or 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 | |
| include SimonSays::Authorizer | |
| self.default_authorization_scope = :current_user | |
| end |
This file contains hidden or 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 Membership < ActiveRecord::Base | |
| include SimonSays::Roleable | |
| belongs_to :user | |
| belongs_to :document | |
| has_roles :download, :edit, :delete, | |
| end |
This file contains hidden or 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 Admin < ActiveRecord::Base | |
| include SimonSays::Roleable | |
| has_roles :design, :support, :moderator, as: :access | |
| end | |
| Admin.new.access | |
| # => [] | |
| Admin.new(access: :support).access |
This file contains hidden or 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
| User.new.roles | |
| # => [] | |
| User.new.tap { |u| u.roles = :add, :edit }.roles | |
| # => [:add, :edit] |
This file contains hidden or 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 User < ActiveRecord::Base | |
| include SimonSays::Roleable | |
| has_roles :add, :edit, :delete | |
| end |
This file contains hidden or 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
| $ gem install simon_says |
This file contains hidden or 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
| $ bundle |
This file contains hidden or 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
| gem 'simon_says' |
This file contains hidden or 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
| # app/controllers/reports_controller.rb | |
| class ReportsController < ApplicationController | |
| authorize_resource :admin, :support | |
| find_resource :report, from: :current_admin, except: [:index, :new, :create] | |
| end |
This file contains hidden or 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
| var magicLibrary = new MagicLibrary(); | |
| var images = document.querySelectorAll('img'); | |
| // All ye Old browsers Beware | |
| images.forEach(function(img) { | |
| var glorifiedDataURI = magicLibrary.glorify(img); | |
| img.src = glorifiedDataURI; | |
| }) |