Skip to content

Swati24/sample_app

Repository files navigation

Rails 3.2 example application shows how to manage set of article's permissions among different user roles.

Requirements:

  • Different user types: Admin, Editor, Reporter and Guest.
  • Reporter can register via the app.
  • Only Admin can create Editor.
  • Reporter can draft an Article.
  • Editor can publish any Article.
  • Guest can read any published Article.
  • Reporter can read only his/her drafts and any published Article.

Gems Support -

  • Devise: gives you ready-made authentication and user management.
  • CanCan: provides authorization for administrator access.
  • Twitter Bootstrap: is a front-end framework for CSS styling.
  • AASM: is a tool to manage states.
  • BetterErrors: is a tool to replace the standard Rails error page with a much better and more useful error page
  • Mailcatcher: is a tool to catches mail and serves it through a dream.
  • Annotate: is a tool to summarize the current schema to the top or bottom of models, fixtures, routes etc.
  • WillPaginate-Bootstrap for styled pagination.
  • ActiveAdmin: for creating elegant backends for website administration.
  • Turbolinks: to intsruct browser not to recompile the JavaScript and CSS between each page change.
  • Heroku: For Server Hosting
  • Rack-Mini-Profiler: to display speed badge for every html page.
  • RailRoady: to generate model and controller UML class diagram generator.
  • RailsFootnotes: to display footnotes in your application for easy debugging, such as sessions, request parameters, cookies, filter chain, routes, queries, etc.
  • Bullet: to notify when one should add eager loading (N+1) queries
  • QuietAssets: to turn off the Rails asset pipeline log
  • LolDba: to scan your application models and displays a list of columns that probably should be indexed.

Assumptions

  • A User can have only one role.
  • An editor can create or publish any article.
  • Guest is a visitor in logged out state.
  • Any user who logins into the app will become the reporter.
  • Only Admin can create an editor and the editor will have to forgot password to change the password and login. An editor can be notified via email.
  • An article can have only two states - drafted and published.
  • Once an article gets published it cannot be unpublished or converted to drafted state.
  • Articles content will be visible as plain text. Markdown has not been implemented.

Set up

Run the below commands to set up the project.

  • Clone the repo -
git clone https://github.com/Swati24/sample_app.git
  • Install Gems -
bundle install
  • Create Database -
rake db:create
  • Migrate Database -
rake db:migrate
  • To add some dummy users to your database -
rake db:seed
  • This will populate your database with following 3 users:
Admin
	Name: Admin
	Email: [email protected]
	Password: testing
	Role: admin
Editor
	Name: Editor
	Email: [email protected]
	Password: testing
	Role: editor
Reporter
	Name: Reporter
	Email: [email protected]
	Password: testing
	Role: reporter
  • Run rails server
rails s

Start using the application

Find this app on http://sampleapp24.herokuapp.com/

Login into the app as per the using the credentials of the desired role.

To access Admin - http://sampleapp24.herokuapp.com/admin

Admin Login credentials

email: [email protected]
password: password

Useful Commands

  • To find missing indexes:
rake db:find_indexes
  • To generate a railroday map for Models
railroady -M | neato -Tpng > models.png
  • To install rails footnotes
rails generate rails_footnotes:install

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published