21
24

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

bootstrap & simple_formでフォームを作る

Posted at

simple_formとは

simple_formとbootstrapを学ぶなら

generator

rails g scaffold Book title:string author:string review:integer description:text
rake db:migrate
rails g bootstrap:themed Books
  • bootstrapのthemedでview/books/*にファイルが作られる
  • admin以下にファイルを生成したいとき rails g bootstrap:themed admin/books bookになる
Usage:
  rails generate bootstrap:themed CONTROLLER_PATH [MODEL_NAME] [Specify application layout] [options]

Options:
  [--excluded-columns=one two three]  # Indicates when to generate excluded columns

Runtime options:
  -f, [--force]                    # Overwrite files that already exist
  -p, [--pretend], [--no-pretend]  # Run but do not make any changes
  -q, [--quiet], [--no-quiet]      # Suppress status output
  -s, [--skip], [--no-skip]        # Skip files that already exist

Description:
    Create bootstrap files for themed generator.

collectionの活用

selection

  • collectionに配列を指定する
= f.input :source, as: :select, required: true, collection: [["Search", :search], ["Manual", :manual]]
  • associationから選択
= f.association :company

simple_enum

= f.input :deliver_cd, collection: f.object.class.delivers.hash
21
24
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
21
24

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?