
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
For now the Wings::Model
module includes FileModel
and SQLite
classes.
# your_app/config/application.rb
require 'wings'
# loading controllers
$LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'app', 'controllers')
module YourApp
class Application < Wings::Application
end
end
# your_app/config.ru
require './config/application'
app = YourApp::Application.new
app.route do
# route for the root path ('/'), format: '[controller#action]
root 'examples#index'
# REST style routes mapping,
# creating routes for [:index, :new, :create, :edit, :show, :update, :destroy]
# options: [:only, :except]
resources :examples, only: [:index, :create, :show]
# standalone route matching
match 'an_example', to: 'examples#an_example'
match 'good_ones/:id', to: 'another_controller#show'
end
run app
match ':controller/:id/:action'
match ':controller/:id', 'action' => 'show'
match ':controller', 'action' => 'index'
Models are put into app/models/
directory.
Wings supports two types of models: FileModel
and SQLite
. Below is an example of creating an Example
model with SQLite
.
We do this by manually creating a migration file first. It creates a connection to the database in db/[your_project].db
and then a table named example
.
require 'sqlite3'
conn = SQLite3::Database.new('db/your_project.db')
conn.execute <<SQL
create table example (
id INTEGER PRIMARY KEY,
column1 VARCHAR(32000),
column2 VARCHAR(100)
);
SQL
Run this migration file.
Create a new file at your_app/app/models/example.rb
# your_app/app/models/example.rb
class Example < Wings::Model::SQLite
end
And you're good to go!
Wings::Model::SQLite
comes with a basic ORM (Object Relational Mapping), which allows you to manipulate your database objects like Ruby objects, with Ruby code. Right now the module supports
create
: insert a row in a database table.find
: find a specific row with id.all
: get all rows in the table.save!
or save
method to update the database.Examples can be found in the following section.
Controllers are put into app/controllers/
directory.
# your_app/app/controllers/examples_controller.rb
Class ExamplesController < Wings::Controller
def index
@examples = Example.all
end
def create
@example = Example.create(**params['example'])
render :show
end
def show
@example = Example.find(params['id'])
end
def an_example
end
end
render
isn't called in the action, Wings will locate the view template in app/views/[controller]/[view].html.erb
.After checking out the repo, run bin/setup
to install dependencies. Then, run rake test
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/jing-jenny-shih/wings. 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.
Everyone interacting in the Wings project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
FAQs
Unknown package
We found that wings-framework 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
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.