Skip to content
A lightweight MVC framework written in Ruby, inspired by Rails
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Lorails is a lightweight MVC framework written in Ruby and inspired by Rails. ControllerBase provides a base controller class, and Router provides basic routing capabilities.


Key Features

Custom controllers that inherit ControllerBase can use the following methods:

  • redirect_to(url): Redirects to the specified url
  • render(template_name): Renders the template located at app/views/<controller_name>/<template_name>.html.erb
  • render_content(content, content_type): Renders content with the specified content type
  • session: A hash that is saved as a cookie and persists throughout the user's session
  • flash and Hashes that are saved as cookies and persist through two HTTP response/request cycles and one HTTP response/request cycle, respectively
  • protect_from_forgery: Checks for an authenticity token from any forms/submitted data when added to custom controllers. Token can be added to forms in your views as follows:
  value="<%= form_authenticity_token %>" />


The Router enables you to map routes to custom controllers:

require_relative '../lib/router'

router =
router.draw do
  get"^/users/new$"), UsersController, :new
  post"^/users$"), UsersController, :create
  get"^/users/(?<user_id>\\d+)$"), UsersController, :show
         UsersController, :destroy
  get"^/$"), UsersController, :index

Rack Middleware

  • ShowExceptions: Renders detailed error messages that contain the following:
    • The stack trace
    • A preview of the source code where the exception was raised
    • The exception message
  • Static: Makes static assets such as images, JavaScript, and CSS files available client-side

Future Features

  • An integrated ORM framework
  • An installable Lorails gem
You can’t perform that action at this time.