Skip to content

gmarik/mini-rails

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

Gem Rails like Sinatra.

Mini Rails is a fun-hack that tweaks Rails routing allowing defining actions in simplest route definitions like match/get blocks. So it's Rails but feels like Sinatra.

Example config.ru

require './lib/rails_mini'

app = Rails.mini do

  config.secret_token = '!*#&$' * 31

  get '/hello' do
    render text: "Hello #{params[:to]}!"
  end

  get '/ping' do
    render json: {'ping' => 'pong'}
  end
end

run app

Installation

gem install rails-mini

Example app

See example

#Motivation Start small. When u ready to grow - get rid of the mini-rails.gem and continue as usual, moving methods into appropriate controllers

Authors

Todo

[x] Better defaults
[/] Sinatra DSL
  [X] block dsl in router
  [X] block dsl behaviours like controller action
    [X] render
    [X] redirect
    [ ]
[ ] real world usage
[ ] example app

Releases

No releases published

Packages

No packages published

Languages