Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
You all have heard about rails, right? (obviously). Rails is a gigantic framework capable of supporting massive projects. Like its name, it can support massive trains (trains) with tons of weight (requirements). Here is rollerskates, a micro MVC built with ruby and is just capable of getting you from here to there.
Add this line to your application's Gemfile:
gem 'rollerskates'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rollerskates
Ensure that your folder structure follow this pattern:
app_name
│
└───app
| └───assets
| └───controllers
| └───models
| └───views
└───config
| └─── routes.rb
| └───application.rb
└───db
| └───app.db
└───config.ru
Set up your application this way:
require 'rollerskates'
module Todolist
class Application < Rollerskates::Application
end
end
Allow your application class to inherit form Rollerskates::Application
class
Set up your routes this way:
APP_ROOT = __dir__
require_relative "./config/application.rb"
TodoApplication = Todolist::Application.new
use Rack::Reloader, 0
use Rack::MethodOverride
require_relative "./config/routes.rb"
use Rack::Static, urls: ["/css", "/js", "/fonts"], root: "/app/assets"
run TodoApplication
TodoApplication.pot.prepare do
get "/", to: "welcome#index"
resources :lists
resources :items, only: :index
end
resources
can also accomodate the only option.
class ItemsController < Rollerskates::BaseController
def index
@items = Item.all
end
def new
end
def show
@item = Item.find(params["id"])
render :show_full
end
end
Just like rails, controller action can take optional render
. If the view to render is not stated explicitly, Rollerskates will render a view with the corresponding contoller action name.
class Item < Rollerskates::BaseRecord
property :name, type: :text, nullable: false
property :status, type: :boolean, nullable: false
create_table
belongs_to :user
has_many :product
def self.recent
order("id DESC").limit(5)
end
end
Rolletskates automatically adds the id, created_at and updated_at
fields and thus need not to be specified in the model. Other properties, however should be specified as above.
You can make use of associations with the rollerskates framework. Also, you can chain methods to a degree. Rollerskates ORM can accommodate chaining such as:
select(:prop1, :prop2, :prop3)
where(prop2: "Value")
order("prop DESC")
limit(5)
And combinations such as:
select(:id, :name).where(status: "active").limit(5)
NB: Unlike Rails, Rollerskates
uses sigular expression for both has_many
and belongs_to
│
└───views
| └───items
| |____ new.erb
| |____ show.erb
|───────layouts
| |____ application.erb
Files in the view folder should be organized according to the controller and action name. Instance variables declared in the respective controller action are available to your view.
The views make use of a layouts. You can abstract common elements in all your views to the views/layouts/application.erb
file.
The tests could be run automatically by using
$ rspec
Bug reports and pull requests are welcome on GitHub at https://github.com/andela-fsenjobi/rollerskates. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that rollerskates demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.