概要
- HanamiはRubyの救世主(メシア)となるか、愚かな星と散るのか
-
http://hanamirb.org/
- Hanami is a modern web framework for Ruby.
- RubyKaigi 2017
- Getting Startedを試してみました。
前提
- macOS Sierra 10.12.5
- Ruby 2.4.1
hanamiインストール
$ mkdir sample_hanami
$ cd sample_hanami
$ bundle init
$ vim Gemfile
+ gem 'hanami'
$ bundle install --path vendor/bundle
hanamiプロジェクト作成
$ bundle exec hanami new . --database=mysql
$ bundle install --path vendor/bundle
hanamiサーバー起動
$ bundle exec hanami server
ブラウザ起動
$ open http://localhost:2300

続き
# Action生成
$ bundle exec hanami generate action web books#index
$ bundle exec hanami generate action web books#new
$ bundle exec hanami generate action web books#create
# Model生成
$ bundle exec hanami generate model book
# DB Migrate (migrationsファイルを編集し、必要なカラムを追加する)
$ bundle exec hanami db prepare