This is a MVC micro webframework, built on top of Rack. This application was built specifically for the purposes of learning how Ruby on Rails works under the hood. In fact, you will notice that many conventions were inspired by Rails.
See daau/rubidium-web-app for an example of a simple web application built using rubidium.
The controller is located at rubidium/controller.rb
Your controllers must be nested within an /app/controllers/
directory, and must inherit the Rubidium::Controller
class.
The controller class name must be camelcase, and appended with 'Controller'
For example, DogsController
or UsersController
To render a view from the controller with some variables, call the following at the end of your controller action:
render(:view, variable: "value")
Routing is based off of Rails 2.0 style routing, where controllers and their corresponding actions are explicitly named within the URL path. For example,
With the following request: GET /dogs/show
the DogsController
will call the show
action.
Your views must be located within /app/views/name_of_controller/name_of_action.html.erb
- Download and install the gem. Since this hasn't been published on Rubygems, you will need to download it from GitHub and install it with a relative path in your Gemfile.
bundle install
- Add
/config/application.rb
and create a class which inherits fromRubidium::Application
. - Add
$LOAD_PATH << File.join(File.dirname(__FILE__), "..", "app", "controllers")
to ensure your controllers are loaded - Add
/config.ru
, require your application, and callrun YourApp.new
bundle exec rackup -p 3000
- You're now running Ruby on
RailsRubidium!
Wasn't that easy? ;)