Giter VIP home page Giter VIP logo

cancannible_demo's Introduction

Cancannible Demo with Rails 3.2

Build Status

A Rails 3.2.x application that demonstrates how to use Cancannible gem for role-based access permissions.

This can be used interactively at cancannibledemo.evendis.com.

See cancannibledemo4.evendis.com for the Rails 4.x version of the demo, with source also on GitHub.

How to run the application locally

# clone the app and bundle (NB: assumes you have a working ruby 1.9.3 environment)
git clone https://github.com/evendis/cancannible_demo.git
cd cancannible_demo
bundle install

# create and verify a db user (the app uses PostgreSQL by defualt)
psql postgres -c "create role cancannible_demo with login superuser"
psql postgres -U cancannible_demo -c "\c"

# setup the database
rake db:setup

# now you are ready to go..
rails s
open http://localhost:3000

Tests

Tests are written with RSpec and are found in the ./spec folder.

Only tests that specifically demonstrate cancannible-related behaviour are included, to avoid confusing the issue.

Guard is also included in the development bundle, so if you wish you can fire it up to run tests as you change files:

bundle exec guard

Implementation Notes

The application uses haml for convenience and clarity. There's no dependency however; all this works fine with ERB or other view styles.

I'm also using inherited_resources for automatic RESTful bahaviour. Yes, it is officially deprecated, but I've yet to find anything that is better than "zero code"!

However, you may not agree (and maybe I'll change my mind one day), so the customers_controller.rb provides an example of how this all works with plain old controllers and standard ERB.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.