├── .gitignore
├── README.md
├── form
├── bulk_registration_form_example
│ ├── .gitignore
│ ├── Gemfile
│ ├── Gemfile.lock
│ ├── README.rdoc
│ ├── Rakefile
│ ├── app
│ │ ├── assets
│ │ │ ├── images
│ │ │ │ └── .keep
│ │ │ ├── javascripts
│ │ │ │ ├── application.js
│ │ │ │ ├── bootstrap.js.coffee
│ │ │ │ ├── common.js.coffee
│ │ │ │ ├── simple_search_form.js.coffee
│ │ │ │ └── tops.js.coffee
│ │ │ └── stylesheets
│ │ │ │ ├── application.css
│ │ │ │ ├── bootstrap_and_overrides.css.less
│ │ │ │ ├── scaffolds.css.scss
│ │ │ │ ├── simple_search_form.css.scss
│ │ │ │ └── tops.css.scss
│ │ ├── controllers
│ │ │ ├── application_controller.rb
│ │ │ ├── concerns
│ │ │ │ └── .keep
│ │ │ └── products_controller.rb
│ │ ├── decorators
│ │ │ └── product_decorator.rb
│ │ ├── helpers
│ │ │ ├── application_helper.rb
│ │ │ └── simple_search_form_helper.rb
│ │ ├── mailers
│ │ │ └── .keep
│ │ ├── models
│ │ │ ├── .keep
│ │ │ ├── concerns
│ │ │ │ └── .keep
│ │ │ ├── form
│ │ │ │ ├── base.rb
│ │ │ │ ├── product.rb
│ │ │ │ └── product_collection.rb
│ │ │ ├── product.rb
│ │ │ └── validators
│ │ │ │ └── kana_validator.rb
│ │ └── views
│ │ │ ├── layouts
│ │ │ └── application.html.erb
│ │ │ ├── products
│ │ │ ├── _errors.html.erb
│ │ │ ├── _search_form.html.erb
│ │ │ ├── index.html.erb
│ │ │ ├── new.html.erb
│ │ │ └── search.html.erb
│ │ │ └── shared
│ │ │ ├── _search_box.html.erb
│ │ │ ├── _search_result_box.html.erb
│ │ │ └── _topnav_link.html.erb
│ ├── bin
│ │ ├── bundle
│ │ ├── rails
│ │ ├── rake
│ │ └── spring
│ ├── config.ru
│ ├── config
│ │ ├── application.rb
│ │ ├── boot.rb
│ │ ├── database.yml
│ │ ├── environment.rb
│ │ ├── environments
│ │ │ ├── development.rb
│ │ │ ├── production.rb
│ │ │ └── test.rb
│ │ ├── initializers
│ │ │ ├── backtrace_silencers.rb
│ │ │ ├── cookies_serializer.rb
│ │ │ ├── filter_parameter_logging.rb
│ │ │ ├── inflections.rb
│ │ │ ├── mime_types.rb
│ │ │ ├── session_store.rb
│ │ │ └── wrap_parameters.rb
│ │ ├── locales
│ │ │ ├── en.bootstrap.yml
│ │ │ ├── en.yml
│ │ │ └── ja.yml
│ │ ├── routes.rb
│ │ └── secrets.yml
│ ├── db
│ │ ├── migrate
│ │ │ └── 20141028082801_create_products.rb
│ │ ├── schema.rb
│ │ └── seeds.rb
│ ├── lib
│ │ ├── assets
│ │ │ └── .keep
│ │ └── tasks
│ │ │ └── .keep
│ ├── log
│ │ └── .keep
│ ├── public
│ │ ├── 404.html
│ │ ├── 422.html
│ │ ├── 500.html
│ │ ├── favicon.ico
│ │ └── robots.txt
│ └── vendor
│ │ └── assets
│ │ ├── javascripts
│ │ └── .keep
│ │ └── stylesheets
│ │ └── .keep
├── datetime_forms
│ ├── .gitignore
│ ├── Gemfile
│ ├── Gemfile.lock
│ ├── README.rdoc
│ ├── Rakefile
│ ├── app
│ │ ├── assets
│ │ │ ├── images
│ │ │ │ └── .keep
│ │ │ ├── javascripts
│ │ │ │ ├── application.js
│ │ │ │ ├── bootstrap.js.coffee
│ │ │ │ ├── common.js.coffee
│ │ │ │ ├── simple_search_form.js.coffee
│ │ │ │ └── tops.js.coffee
│ │ │ └── stylesheets
│ │ │ │ ├── application.css
│ │ │ │ ├── bootstrap_and_overrides.css.less
│ │ │ │ ├── scaffolds.css.scss
│ │ │ │ ├── simple_search_form.css.scss
│ │ │ │ └── tops.css.scss
│ │ ├── controllers
│ │ │ ├── application_controller.rb
│ │ │ ├── concerns
│ │ │ │ └── .keep
│ │ │ └── products_controller.rb
│ │ ├── helpers
│ │ │ ├── application_helper.rb
│ │ │ ├── orders_helper.rb
│ │ │ ├── simple_search_form_helper.rb
│ │ │ └── tops_helper.rb
│ │ ├── mailers
│ │ │ └── .keep
│ │ ├── models
│ │ │ ├── .keep
│ │ │ ├── concerns
│ │ │ │ └── .keep
│ │ │ ├── form
│ │ │ │ └── product.rb
│ │ │ └── product.rb
│ │ └── views
│ │ │ ├── layouts
│ │ │ └── application.html.erb
│ │ │ ├── products
│ │ │ ├── _form.html.erb
│ │ │ ├── edit.html.erb
│ │ │ ├── index.html.erb
│ │ │ └── new.html.erb
│ │ │ └── shared
│ │ │ ├── _search_box.html.erb
│ │ │ ├── _search_result_box.html.erb
│ │ │ └── _topnav_link.html.erb
│ ├── bin
│ │ ├── bundle
│ │ ├── rails
│ │ ├── rake
│ │ └── spring
│ ├── config.ru
│ ├── config
│ │ ├── application.rb
│ │ ├── boot.rb
│ │ ├── database.yml
│ │ ├── environment.rb
│ │ ├── environments
│ │ │ ├── development.rb
│ │ │ ├── production.rb
│ │ │ └── test.rb
│ │ ├── initializers
│ │ │ ├── backtrace_silencers.rb
│ │ │ ├── cookies_serializer.rb
│ │ │ ├── filter_parameter_logging.rb
│ │ │ ├── inflections.rb
│ │ │ ├── mime_types.rb
│ │ │ ├── session_store.rb
│ │ │ └── wrap_parameters.rb
│ │ ├── locales
│ │ │ ├── en.bootstrap.yml
│ │ │ ├── en.yml
│ │ │ └── ja.yml
│ │ ├── routes.rb
│ │ └── secrets.yml
│ ├── db
│ │ ├── migrate
│ │ │ └── 20141028082801_create_products.rb
│ │ ├── schema.rb
│ │ └── seeds.rb
│ ├── lib
│ │ ├── assets
│ │ │ └── .keep
│ │ └── tasks
│ │ │ └── .keep
│ ├── log
│ │ └── .keep
│ ├── public
│ │ ├── 404.html
│ │ ├── 422.html
│ │ ├── 500.html
│ │ ├── favicon.ico
│ │ └── robots.txt
│ └── vendor
│ │ └── assets
│ │ ├── javascripts
│ │ └── .keep
│ │ └── stylesheets
│ │ └── .keep
├── datetime_js_forms
│ ├── .gitignore
│ ├── Gemfile
│ ├── Gemfile.lock
│ ├── README.rdoc
│ ├── Rakefile
│ ├── app
│ │ ├── assets
│ │ │ ├── images
│ │ │ │ └── .keep
│ │ │ ├── javascripts
│ │ │ │ ├── application.js
│ │ │ │ ├── bootstrap.js.coffee
│ │ │ │ ├── common.js.coffee
│ │ │ │ ├── simple_search_form.js.coffee
│ │ │ │ └── tops.js.coffee
│ │ │ └── stylesheets
│ │ │ │ ├── application.css
│ │ │ │ ├── bootstrap_and_overrides.css.less
│ │ │ │ ├── scaffolds.css.scss
│ │ │ │ ├── simple_search_form.css.scss
│ │ │ │ └── tops.css.scss
│ │ ├── controllers
│ │ │ ├── application_controller.rb
│ │ │ ├── concerns
│ │ │ │ └── .keep
│ │ │ └── products_controller.rb
│ │ ├── helpers
│ │ │ ├── application_helper.rb
│ │ │ ├── orders_helper.rb
│ │ │ ├── simple_search_form_helper.rb
│ │ │ └── tops_helper.rb
│ │ ├── mailers
│ │ │ └── .keep
│ │ ├── models
│ │ │ ├── .keep
│ │ │ ├── concerns
│ │ │ │ ├── .keep
│ │ │ │ └── datetime_integratable.rb
│ │ │ ├── form
│ │ │ │ └── product.rb
│ │ │ └── product.rb
│ │ └── views
│ │ │ ├── layouts
│ │ │ └── application.html.erb
│ │ │ ├── products
│ │ │ ├── _form.html.erb
│ │ │ ├── edit.html.erb
│ │ │ ├── index.html.erb
│ │ │ └── new.html.erb
│ │ │ └── shared
│ │ │ ├── _search_box.html.erb
│ │ │ ├── _search_result_box.html.erb
│ │ │ └── _topnav_link.html.erb
│ ├── bin
│ │ ├── bundle
│ │ ├── rails
│ │ ├── rake
│ │ └── spring
│ ├── config.ru
│ ├── config
│ │ ├── application.rb
│ │ ├── boot.rb
│ │ ├── database.yml
│ │ ├── environment.rb
│ │ ├── environments
│ │ │ ├── development.rb
│ │ │ ├── production.rb
│ │ │ └── test.rb
│ │ ├── initializers
│ │ │ ├── backtrace_silencers.rb
│ │ │ ├── cookies_serializer.rb
│ │ │ ├── filter_parameter_logging.rb
│ │ │ ├── inflections.rb
│ │ │ ├── mime_types.rb
│ │ │ ├── session_store.rb
│ │ │ └── wrap_parameters.rb
│ │ ├── locales
│ │ │ ├── en.bootstrap.yml
│ │ │ ├── en.yml
│ │ │ └── ja.yml
│ │ ├── routes.rb
│ │ └── secrets.yml
│ ├── db
│ │ ├── migrate
│ │ │ └── 20141028082801_create_products.rb
│ │ ├── schema.rb
│ │ └── seeds.rb
│ ├── lib
│ │ ├── assets
│ │ │ └── .keep
│ │ └── tasks
│ │ │ └── .keep
│ ├── log
│ │ └── .keep
│ ├── public
│ │ ├── 404.html
│ │ ├── 422.html
│ │ ├── 500.html
│ │ ├── assets
│ │ │ └── twitter
│ │ │ │ └── fonts
│ │ │ │ ├── glyphicons-halflings-regular.eot
│ │ │ │ ├── glyphicons-halflings-regular.svg
│ │ │ │ ├── glyphicons-halflings-regular.ttf
│ │ │ │ └── glyphicons-halflings-regular.woff
│ │ ├── favicon.ico
│ │ └── robots.txt
│ └── vendor
│ │ └── assets
│ │ ├── javascripts
│ │ └── .keep
│ │ └── stylesheets
│ │ └── .keep
├── double_submit_protection
│ ├── .gitignore
│ ├── Gemfile
│ ├── Gemfile.lock
│ ├── README.rdoc
│ ├── Rakefile
│ ├── app
│ │ ├── assets
│ │ │ ├── images
│ │ │ │ └── .keep
│ │ │ ├── javascripts
│ │ │ │ ├── application.js
│ │ │ │ ├── bootstrap.js.coffee
│ │ │ │ ├── common.js.coffee
│ │ │ │ └── contacts.js.coffee
│ │ │ └── stylesheets
│ │ │ │ ├── application.css
│ │ │ │ ├── bootstrap_and_overrides.css.less
│ │ │ │ ├── contacts.css.scss
│ │ │ │ ├── scaffolds.css.scss
│ │ │ │ ├── simple_search_form.css.scss
│ │ │ │ └── tops.css.scss
│ │ ├── controllers
│ │ │ ├── application_controller.rb
│ │ │ ├── concerns
│ │ │ │ └── .keep
│ │ │ └── contacts_controller.rb
│ │ ├── helpers
│ │ │ ├── application_helper.rb
│ │ │ ├── contacts_helper.rb
│ │ │ ├── orders_helper.rb
│ │ │ ├── simple_search_form_helper.rb
│ │ │ └── tops_helper.rb
│ │ ├── mailers
│ │ │ └── .keep
│ │ ├── models
│ │ │ ├── .keep
│ │ │ ├── concerns
│ │ │ │ └── .keep
│ │ │ └── contact.rb
│ │ └── views
│ │ │ ├── contacts
│ │ │ ├── index.html.erb
│ │ │ └── new.html.erb
│ │ │ ├── layouts
│ │ │ └── application.html.erb
│ │ │ └── shared
│ │ │ └── _topnav_link.html.erb
│ ├── bin
│ │ ├── bundle
│ │ ├── rails
│ │ ├── rake
│ │ └── spring
│ ├── config.ru
│ ├── config
│ │ ├── application.rb
│ │ ├── boot.rb
│ │ ├── database.yml
│ │ ├── environment.rb
│ │ ├── environments
│ │ │ ├── development.rb
│ │ │ ├── production.rb
│ │ │ └── test.rb
│ │ ├── initializers
│ │ │ ├── backtrace_silencers.rb
│ │ │ ├── cookies_serializer.rb
│ │ │ ├── filter_parameter_logging.rb
│ │ │ ├── inflections.rb
│ │ │ ├── mime_types.rb
│ │ │ ├── session_store.rb
│ │ │ └── wrap_parameters.rb
│ │ ├── locales
│ │ │ ├── en.bootstrap.yml
│ │ │ ├── en.yml
│ │ │ └── ja.yml
│ │ ├── routes.rb
│ │ ├── secrets.yml
│ │ └── unicorn.rb
│ ├── db
│ │ ├── migrate
│ │ │ └── 20141116091300_create_contacts.rb
│ │ ├── schema.rb
│ │ └── seeds.rb
│ ├── exec_server.sh
│ ├── lib
│ │ ├── assets
│ │ │ └── .keep
│ │ └── tasks
│ │ │ └── .keep
│ ├── log
│ │ └── .keep
│ ├── public
│ │ ├── 404.html
│ │ ├── 422.html
│ │ ├── 500.html
│ │ ├── favicon.ico
│ │ └── robots.txt
│ └── vendor
│ │ └── assets
│ │ ├── javascripts
│ │ └── .keep
│ │ └── stylesheets
│ │ └── .keep
├── dynamic_nested_forms
│ ├── .gitignore
│ ├── Gemfile
│ ├── Gemfile.lock
│ ├── README.rdoc
│ ├── Rakefile
│ ├── app
│ │ ├── assets
│ │ │ ├── images
│ │ │ │ └── .keep
│ │ │ ├── javascripts
│ │ │ │ ├── application.js
│ │ │ │ ├── bootstrap.js.coffee
│ │ │ │ ├── common.js.coffee
│ │ │ │ ├── simple_search_form.js.coffee
│ │ │ │ └── tops.js.coffee
│ │ │ └── stylesheets
│ │ │ │ ├── application.css
│ │ │ │ ├── bootstrap_and_overrides.css.less
│ │ │ │ ├── scaffolds.css.scss
│ │ │ │ ├── simple_search_form.css.scss
│ │ │ │ └── tops.css.scss
│ │ ├── controllers
│ │ │ ├── application_controller.rb
│ │ │ ├── concerns
│ │ │ │ └── .keep
│ │ │ ├── orders_controller.rb
│ │ │ └── products_controller.rb
│ │ ├── decorators
│ │ │ └── product_decorator.rb
│ │ ├── helpers
│ │ │ ├── application_helper.rb
│ │ │ ├── orders_helper.rb
│ │ │ ├── simple_search_form_helper.rb
│ │ │ └── tops_helper.rb
│ │ ├── mailers
│ │ │ └── .keep
│ │ ├── models
│ │ │ ├── .keep
│ │ │ ├── concerns
│ │ │ │ └── .keep
│ │ │ ├── corporation.rb
│ │ │ ├── form
│ │ │ │ ├── order.rb
│ │ │ │ └── order_detail.rb
│ │ │ ├── order.rb
│ │ │ ├── order_detail.rb
│ │ │ └── product.rb
│ │ └── views
│ │ │ ├── layouts
│ │ │ └── application.html.erb
│ │ │ ├── orders
│ │ │ ├── _form.html.erb
│ │ │ ├── _order_detail_fields.html.erb
│ │ │ ├── _search_form.html.erb
│ │ │ ├── edit.html.erb
│ │ │ ├── index.html.erb
│ │ │ ├── new.html.erb
│ │ │ ├── search.html.erb
│ │ │ └── show.html.erb
│ │ │ ├── products
│ │ │ ├── _search_form.html.erb
│ │ │ ├── index.html.erb
│ │ │ └── search.html.erb
│ │ │ └── shared
│ │ │ ├── _search_box.html.erb
│ │ │ ├── _search_result_box.html.erb
│ │ │ └── _topnav_link.html.erb
│ ├── bin
│ │ ├── bundle
│ │ ├── rails
│ │ ├── rake
│ │ └── spring
│ ├── config.ru
│ ├── config
│ │ ├── application.rb
│ │ ├── boot.rb
│ │ ├── database.yml
│ │ ├── environment.rb
│ │ ├── environments
│ │ │ ├── development.rb
│ │ │ ├── production.rb
│ │ │ └── test.rb
│ │ ├── initializers
│ │ │ ├── backtrace_silencers.rb
│ │ │ ├── cookies_serializer.rb
│ │ │ ├── filter_parameter_logging.rb
│ │ │ ├── inflections.rb
│ │ │ ├── mime_types.rb
│ │ │ ├── session_store.rb
│ │ │ └── wrap_parameters.rb
│ │ ├── locales
│ │ │ ├── en.bootstrap.yml
│ │ │ ├── en.yml
│ │ │ └── ja.yml
│ │ ├── routes.rb
│ │ └── secrets.yml
│ ├── db
│ │ ├── migrate
│ │ │ ├── 20141028082801_create_products.rb
│ │ │ ├── 20141031055542_create_corporations.rb
│ │ │ ├── 20141031055711_create_orders.rb
│ │ │ └── 20141031060607_create_order_details.rb
│ │ ├── schema.rb
│ │ └── seeds.rb
│ ├── lib
│ │ ├── assets
│ │ │ └── .keep
│ │ └── tasks
│ │ │ └── .keep
│ ├── log
│ │ └── .keep
│ ├── public
│ │ ├── 404.html
│ │ ├── 422.html
│ │ ├── 500.html
│ │ ├── favicon.ico
│ │ └── robots.txt
│ └── vendor
│ │ └── assets
│ │ ├── javascripts
│ │ └── .keep
│ │ └── stylesheets
│ │ └── .keep
├── form_object_example
│ ├── .gitignore
│ ├── Gemfile
│ ├── Gemfile.lock
│ ├── README.rdoc
│ ├── Rakefile
│ ├── app
│ │ ├── assets
│ │ │ ├── images
│ │ │ │ └── .keep
│ │ │ ├── javascripts
│ │ │ │ ├── application.js
│ │ │ │ ├── bootstrap.js.coffee
│ │ │ │ ├── simple_search_form.js.coffee
│ │ │ │ └── tops.js.coffee
│ │ │ └── stylesheets
│ │ │ │ ├── application.css
│ │ │ │ ├── bootstrap_and_overrides.css.less
│ │ │ │ ├── scaffolds.css.scss
│ │ │ │ ├── simple_search_form.css.scss
│ │ │ │ └── tops.css.scss
│ │ ├── controllers
│ │ │ ├── application_controller.rb
│ │ │ ├── concerns
│ │ │ │ └── .keep
│ │ │ └── products_controller.rb
│ │ ├── decorators
│ │ │ └── product_decorator.rb
│ │ ├── helpers
│ │ │ ├── application_helper.rb
│ │ │ ├── simple_search_form_helper.rb
│ │ │ └── tops_helper.rb
│ │ ├── mailers
│ │ │ └── .keep
│ │ ├── models
│ │ │ ├── .keep
│ │ │ ├── concerns
│ │ │ │ └── .keep
│ │ │ ├── product.rb
│ │ │ └── search
│ │ │ │ ├── base.rb
│ │ │ │ └── product.rb
│ │ └── views
│ │ │ ├── layouts
│ │ │ └── application.html.erb
│ │ │ ├── products
│ │ │ ├── _search_form.html.erb
│ │ │ ├── index.html.erb
│ │ │ └── search.html.erb
│ │ │ └── shared
│ │ │ ├── _search_box.html.erb
│ │ │ ├── _search_result_box.html.erb
│ │ │ └── _topnav_link.html.erb
│ ├── bin
│ │ ├── bundle
│ │ ├── rails
│ │ ├── rake
│ │ └── spring
│ ├── config.ru
│ ├── config
│ │ ├── application.rb
│ │ ├── boot.rb
│ │ ├── database.yml
│ │ ├── environment.rb
│ │ ├── environments
│ │ │ ├── development.rb
│ │ │ ├── production.rb
│ │ │ └── test.rb
│ │ ├── initializers
│ │ │ ├── backtrace_silencers.rb
│ │ │ ├── cookies_serializer.rb
│ │ │ ├── filter_parameter_logging.rb
│ │ │ ├── inflections.rb
│ │ │ ├── mime_types.rb
│ │ │ ├── session_store.rb
│ │ │ └── wrap_parameters.rb
│ │ ├── locales
│ │ │ ├── en.bootstrap.yml
│ │ │ ├── en.yml
│ │ │ └── ja.yml
│ │ ├── routes.rb
│ │ └── secrets.yml
│ ├── db
│ │ ├── migrate
│ │ │ └── 20141028082801_create_products.rb
│ │ ├── schema.rb
│ │ └── seeds.rb
│ ├── lib
│ │ ├── assets
│ │ │ └── .keep
│ │ └── tasks
│ │ │ └── .keep
│ ├── log
│ │ └── .keep
│ ├── public
│ │ ├── 404.html
│ │ ├── 422.html
│ │ ├── 500.html
│ │ ├── favicon.ico
│ │ └── robots.txt
│ └── vendor
│ │ └── assets
│ │ ├── javascripts
│ │ └── .keep
│ │ └── stylesheets
│ │ └── .keep
├── many_to_many_checkbox_forms
│ ├── .gitignore
│ ├── Gemfile
│ ├── Gemfile.lock
│ ├── README.rdoc
│ ├── Rakefile
│ ├── app
│ │ ├── assets
│ │ │ ├── images
│ │ │ │ └── .keep
│ │ │ ├── javascripts
│ │ │ │ ├── application.js
│ │ │ │ ├── bootstrap.js.coffee
│ │ │ │ ├── common.js.coffee
│ │ │ │ ├── simple_search_form.js.coffee
│ │ │ │ └── tops.js.coffee
│ │ │ └── stylesheets
│ │ │ │ ├── application.css
│ │ │ │ ├── bootstrap_and_overrides.css.less
│ │ │ │ ├── scaffolds.css.scss
│ │ │ │ ├── simple_search_form.css.scss
│ │ │ │ └── tops.css.scss
│ │ ├── controllers
│ │ │ ├── application_controller.rb
│ │ │ ├── concerns
│ │ │ │ └── .keep
│ │ │ └── products_controller.rb
│ │ ├── decorators
│ │ │ └── product_decorator.rb
│ │ ├── helpers
│ │ │ ├── application_helper.rb
│ │ │ ├── orders_helper.rb
│ │ │ ├── simple_search_form_helper.rb
│ │ │ └── tops_helper.rb
│ │ ├── mailers
│ │ │ └── .keep
│ │ ├── models
│ │ │ ├── .keep
│ │ │ ├── category.rb
│ │ │ ├── concerns
│ │ │ │ └── .keep
│ │ │ ├── form
│ │ │ │ └── product.rb
│ │ │ ├── product.rb
│ │ │ ├── product_category.rb
│ │ │ └── validators
│ │ │ │ └── kana_validator.rb
│ │ └── views
│ │ │ ├── layouts
│ │ │ └── application.html.erb
│ │ │ ├── products
│ │ │ ├── _form.html.erb
│ │ │ ├── _search_form.html.erb
│ │ │ ├── edit.html.erb
│ │ │ ├── index.html.erb
│ │ │ ├── new.html.erb
│ │ │ └── search.html.erb
│ │ │ └── shared
│ │ │ ├── _search_box.html.erb
│ │ │ ├── _search_result_box.html.erb
│ │ │ └── _topnav_link.html.erb
│ ├── bin
│ │ ├── bundle
│ │ ├── rails
│ │ ├── rake
│ │ └── spring
│ ├── config.ru
│ ├── config
│ │ ├── application.rb
│ │ ├── boot.rb
│ │ ├── database.yml
│ │ ├── environment.rb
│ │ ├── environments
│ │ │ ├── development.rb
│ │ │ ├── production.rb
│ │ │ └── test.rb
│ │ ├── initializers
│ │ │ ├── backtrace_silencers.rb
│ │ │ ├── cookies_serializer.rb
│ │ │ ├── filter_parameter_logging.rb
│ │ │ ├── inflections.rb
│ │ │ ├── mime_types.rb
│ │ │ ├── session_store.rb
│ │ │ └── wrap_parameters.rb
│ │ ├── locales
│ │ │ ├── en.bootstrap.yml
│ │ │ ├── en.yml
│ │ │ └── ja.yml
│ │ ├── routes.rb
│ │ └── secrets.yml
│ ├── db
│ │ ├── migrate
│ │ │ ├── 20141028082801_create_products.rb
│ │ │ ├── 20141103073126_create_categories.rb
│ │ │ └── 20141103073210_create_product_categories.rb
│ │ ├── schema.rb
│ │ └── seeds.rb
│ ├── lib
│ │ ├── assets
│ │ │ └── .keep
│ │ └── tasks
│ │ │ └── .keep
│ ├── log
│ │ └── .keep
│ ├── public
│ │ ├── 404.html
│ │ ├── 422.html
│ │ ├── 500.html
│ │ ├── favicon.ico
│ │ └── robots.txt
│ └── vendor
│ │ └── assets
│ │ ├── javascripts
│ │ └── .keep
│ │ └── stylesheets
│ │ └── .keep
├── many_to_many_forms
│ ├── .gitignore
│ ├── Gemfile
│ ├── Gemfile.lock
│ ├── README.rdoc
│ ├── Rakefile
│ ├── app
│ │ ├── assets
│ │ │ ├── images
│ │ │ │ └── .keep
│ │ │ ├── javascripts
│ │ │ │ ├── application.js
│ │ │ │ ├── bootstrap.js.coffee
│ │ │ │ ├── common.js.coffee
│ │ │ │ ├── simple_search_form.js.coffee
│ │ │ │ └── tops.js.coffee
│ │ │ └── stylesheets
│ │ │ │ ├── application.css
│ │ │ │ ├── bootstrap_and_overrides.css.less
│ │ │ │ ├── scaffolds.css.scss
│ │ │ │ ├── simple_search_form.css.scss
│ │ │ │ └── tops.css.scss
│ │ ├── controllers
│ │ │ ├── application_controller.rb
│ │ │ ├── concerns
│ │ │ │ └── .keep
│ │ │ └── products_controller.rb
│ │ ├── decorators
│ │ │ └── product_decorator.rb
│ │ ├── helpers
│ │ │ ├── application_helper.rb
│ │ │ ├── orders_helper.rb
│ │ │ ├── simple_search_form_helper.rb
│ │ │ └── tops_helper.rb
│ │ ├── mailers
│ │ │ └── .keep
│ │ ├── models
│ │ │ ├── .keep
│ │ │ ├── category.rb
│ │ │ ├── concerns
│ │ │ │ └── .keep
│ │ │ ├── form
│ │ │ │ ├── product.rb
│ │ │ │ └── product_category.rb
│ │ │ ├── product.rb
│ │ │ ├── product_category.rb
│ │ │ └── validators
│ │ │ │ └── kana_validator.rb
│ │ └── views
│ │ │ ├── layouts
│ │ │ └── application.html.erb
│ │ │ ├── products
│ │ │ ├── _form.html.erb
│ │ │ ├── _product_category_fields.html.erb
│ │ │ ├── _search_form.html.erb
│ │ │ ├── edit.html.erb
│ │ │ ├── index.html.erb
│ │ │ ├── new.html.erb
│ │ │ └── search.html.erb
│ │ │ └── shared
│ │ │ ├── _search_box.html.erb
│ │ │ ├── _search_result_box.html.erb
│ │ │ └── _topnav_link.html.erb
│ ├── bin
│ │ ├── bundle
│ │ ├── rails
│ │ ├── rake
│ │ └── spring
│ ├── config.ru
│ ├── config
│ │ ├── application.rb
│ │ ├── boot.rb
│ │ ├── database.yml
│ │ ├── environment.rb
│ │ ├── environments
│ │ │ ├── development.rb
│ │ │ ├── production.rb
│ │ │ └── test.rb
│ │ ├── initializers
│ │ │ ├── backtrace_silencers.rb
│ │ │ ├── cookies_serializer.rb
│ │ │ ├── filter_parameter_logging.rb
│ │ │ ├── inflections.rb
│ │ │ ├── mime_types.rb
│ │ │ ├── session_store.rb
│ │ │ └── wrap_parameters.rb
│ │ ├── locales
│ │ │ ├── en.bootstrap.yml
│ │ │ ├── en.yml
│ │ │ └── ja.yml
│ │ ├── routes.rb
│ │ └── secrets.yml
│ ├── db
│ │ ├── migrate
│ │ │ ├── 20141028082801_create_products.rb
│ │ │ ├── 20141103073126_create_categories.rb
│ │ │ └── 20141103073210_create_product_categories.rb
│ │ ├── schema.rb
│ │ └── seeds.rb
│ ├── lib
│ │ ├── assets
│ │ │ └── .keep
│ │ └── tasks
│ │ │ └── .keep
│ ├── log
│ │ └── .keep
│ ├── public
│ │ ├── 404.html
│ │ ├── 422.html
│ │ ├── 500.html
│ │ ├── favicon.ico
│ │ └── robots.txt
│ └── vendor
│ │ └── assets
│ │ ├── javascripts
│ │ └── .keep
│ │ └── stylesheets
│ │ └── .keep
└── ransack_search_example
│ ├── .gitignore
│ ├── Gemfile
│ ├── Gemfile.lock
│ ├── README.rdoc
│ ├── Rakefile
│ ├── app
│ ├── assets
│ │ ├── images
│ │ │ └── .keep
│ │ ├── javascripts
│ │ │ ├── application.js
│ │ │ ├── bootstrap.js.coffee
│ │ │ ├── simple_search_form.js.coffee
│ │ │ └── tops.js.coffee
│ │ └── stylesheets
│ │ │ ├── application.css
│ │ │ ├── bootstrap_and_overrides.css.less
│ │ │ ├── scaffolds.css.scss
│ │ │ ├── simple_search_form.css.scss
│ │ │ └── tops.css.scss
│ ├── controllers
│ │ ├── application_controller.rb
│ │ ├── concerns
│ │ │ └── .keep
│ │ └── products_controller.rb
│ ├── decorators
│ │ └── product_decorator.rb
│ ├── helpers
│ │ ├── application_helper.rb
│ │ ├── simple_search_form_helper.rb
│ │ └── tops_helper.rb
│ ├── mailers
│ │ └── .keep
│ ├── models
│ │ ├── .keep
│ │ ├── concerns
│ │ │ └── .keep
│ │ └── product.rb
│ └── views
│ │ ├── layouts
│ │ └── application.html.erb
│ │ ├── products
│ │ ├── _search_form.html.erb
│ │ ├── index.html.erb
│ │ └── search.html.erb
│ │ └── shared
│ │ ├── _search_box.html.erb
│ │ ├── _search_result_box.html.erb
│ │ └── _topnav_link.html.erb
│ ├── bin
│ ├── bundle
│ ├── rails
│ ├── rake
│ └── spring
│ ├── config.ru
│ ├── config
│ ├── application.rb
│ ├── boot.rb
│ ├── database.yml
│ ├── environment.rb
│ ├── environments
│ │ ├── development.rb
│ │ ├── production.rb
│ │ └── test.rb
│ ├── initializers
│ │ ├── backtrace_silencers.rb
│ │ ├── cookies_serializer.rb
│ │ ├── filter_parameter_logging.rb
│ │ ├── inflections.rb
│ │ ├── mime_types.rb
│ │ ├── session_store.rb
│ │ └── wrap_parameters.rb
│ ├── locales
│ │ ├── en.bootstrap.yml
│ │ ├── en.yml
│ │ └── ja.yml
│ ├── routes.rb
│ └── secrets.yml
│ ├── db
│ ├── migrate
│ │ └── 20141028082801_create_products.rb
│ ├── schema.rb
│ └── seeds.rb
│ ├── lib
│ ├── assets
│ │ └── .keep
│ └── tasks
│ │ └── .keep
│ ├── log
│ └── .keep
│ ├── public
│ ├── 404.html
│ ├── 422.html
│ ├── 500.html
│ ├── favicon.ico
│ └── robots.txt
│ └── vendor
│ └── assets
│ ├── javascripts
│ └── .keep
│ └── stylesheets
│ └── .keep
├── guide_template
├── assets
│ ├── javascripts
│ │ ├── application.js
│ │ └── bootstrap.js.coffee
│ └── stylesheets
│ │ ├── application.css
│ │ ├── bootstrap_and_overrides.css.less
│ │ └── scaffolds.css.scss
├── config
│ └── locales
│ │ └── ja.yml
├── guide_template.rb
├── helpers
│ └── application_helper.rb
└── views
│ ├── layouts
│ └── application.html.erb
│ └── shared
│ ├── _search_box.html.erb
│ ├── _search_result_box.html.erb
│ └── _topnav_link.html.erb
├── report
├── csv_export
│ ├── .gitignore
│ ├── Gemfile
│ ├── Gemfile.lock
│ ├── README.rdoc
│ ├── Rakefile
│ ├── app
│ │ ├── assets
│ │ │ ├── images
│ │ │ │ └── .keep
│ │ │ ├── javascripts
│ │ │ │ ├── application.js
│ │ │ │ ├── bootstrap.js.coffee
│ │ │ │ ├── simple_search_form.js.coffee
│ │ │ │ └── tops.js.coffee
│ │ │ └── stylesheets
│ │ │ │ ├── application.css
│ │ │ │ ├── bootstrap_and_overrides.css.less
│ │ │ │ ├── scaffolds.css.scss
│ │ │ │ ├── simple_search_form.css.scss
│ │ │ │ └── tops.css.scss
│ │ ├── controllers
│ │ │ ├── application_controller.rb
│ │ │ ├── concerns
│ │ │ │ └── .keep
│ │ │ └── products_controller.rb
│ │ ├── decorators
│ │ │ ├── product_decorator.rb
│ │ │ └── products_decorator.rb
│ │ ├── helpers
│ │ │ ├── application_helper.rb
│ │ │ ├── simple_search_form_helper.rb
│ │ │ └── tops_helper.rb
│ │ ├── mailers
│ │ │ └── .keep
│ │ ├── models
│ │ │ ├── .keep
│ │ │ ├── concerns
│ │ │ │ ├── .keep
│ │ │ │ └── csv_exportable.rb
│ │ │ └── product.rb
│ │ └── views
│ │ │ ├── layouts
│ │ │ └── application.html.erb
│ │ │ ├── products
│ │ │ └── index.html.erb
│ │ │ └── shared
│ │ │ ├── _search_box.html.erb
│ │ │ ├── _search_result_box.html.erb
│ │ │ └── _topnav_link.html.erb
│ ├── bin
│ │ ├── bundle
│ │ ├── rails
│ │ ├── rake
│ │ └── spring
│ ├── config.ru
│ ├── config
│ │ ├── application.rb
│ │ ├── boot.rb
│ │ ├── database.yml
│ │ ├── environment.rb
│ │ ├── environments
│ │ │ ├── development.rb
│ │ │ ├── production.rb
│ │ │ └── test.rb
│ │ ├── initializers
│ │ │ ├── backtrace_silencers.rb
│ │ │ ├── cookies_serializer.rb
│ │ │ ├── filter_parameter_logging.rb
│ │ │ ├── inflections.rb
│ │ │ ├── mime_types.rb
│ │ │ ├── session_store.rb
│ │ │ └── wrap_parameters.rb
│ │ ├── locales
│ │ │ ├── en.bootstrap.yml
│ │ │ ├── en.yml
│ │ │ └── ja.yml
│ │ ├── routes.rb
│ │ └── secrets.yml
│ ├── db
│ │ ├── migrate
│ │ │ └── 20141028082801_create_products.rb
│ │ ├── schema.rb
│ │ └── seeds.rb
│ ├── lib
│ │ ├── assets
│ │ │ └── .keep
│ │ └── tasks
│ │ │ └── .keep
│ ├── log
│ │ └── .keep
│ ├── public
│ │ ├── 404.html
│ │ ├── 422.html
│ │ ├── 500.html
│ │ ├── favicon.ico
│ │ └── robots.txt
│ └── vendor
│ │ └── assets
│ │ ├── javascripts
│ │ └── .keep
│ │ └── stylesheets
│ │ └── .keep
├── search_csv_export
│ ├── .gitignore
│ ├── Gemfile
│ ├── Gemfile.lock
│ ├── README.rdoc
│ ├── Rakefile
│ ├── app
│ │ ├── assets
│ │ │ ├── images
│ │ │ │ └── .keep
│ │ │ ├── javascripts
│ │ │ │ ├── application.js
│ │ │ │ ├── bootstrap.js.coffee
│ │ │ │ ├── simple_search_form.js.coffee
│ │ │ │ └── tops.js.coffee
│ │ │ └── stylesheets
│ │ │ │ ├── application.css
│ │ │ │ ├── bootstrap_and_overrides.css.less
│ │ │ │ ├── scaffolds.css.scss
│ │ │ │ ├── simple_search_form.css.scss
│ │ │ │ └── tops.css.scss
│ │ ├── controllers
│ │ │ ├── application_controller.rb
│ │ │ ├── concerns
│ │ │ │ └── .keep
│ │ │ └── products_controller.rb
│ │ ├── decorators
│ │ │ ├── product_decorator.rb
│ │ │ └── products_decorator.rb
│ │ ├── helpers
│ │ │ ├── application_helper.rb
│ │ │ ├── simple_search_form_helper.rb
│ │ │ └── tops_helper.rb
│ │ ├── mailers
│ │ │ └── .keep
│ │ ├── models
│ │ │ ├── .keep
│ │ │ ├── concerns
│ │ │ │ ├── .keep
│ │ │ │ └── csv_exportable.rb
│ │ │ └── product.rb
│ │ └── views
│ │ │ ├── layouts
│ │ │ └── application.html.erb
│ │ │ ├── products
│ │ │ ├── _search_form.html.erb
│ │ │ ├── index.html.erb
│ │ │ └── search.html.erb
│ │ │ └── shared
│ │ │ ├── _search_box.html.erb
│ │ │ ├── _search_result_box.html.erb
│ │ │ └── _topnav_link.html.erb
│ ├── bin
│ │ ├── bundle
│ │ ├── rails
│ │ ├── rake
│ │ └── spring
│ ├── config.ru
│ ├── config
│ │ ├── application.rb
│ │ ├── boot.rb
│ │ ├── database.yml
│ │ ├── environment.rb
│ │ ├── environments
│ │ │ ├── development.rb
│ │ │ ├── production.rb
│ │ │ └── test.rb
│ │ ├── initializers
│ │ │ ├── backtrace_silencers.rb
│ │ │ ├── cookies_serializer.rb
│ │ │ ├── filter_parameter_logging.rb
│ │ │ ├── inflections.rb
│ │ │ ├── mime_types.rb
│ │ │ ├── session_store.rb
│ │ │ └── wrap_parameters.rb
│ │ ├── locales
│ │ │ ├── en.bootstrap.yml
│ │ │ ├── en.yml
│ │ │ └── ja.yml
│ │ ├── routes.rb
│ │ └── secrets.yml
│ ├── db
│ │ ├── migrate
│ │ │ └── 20141028082801_create_products.rb
│ │ ├── schema.rb
│ │ └── seeds.rb
│ ├── lib
│ │ ├── assets
│ │ │ └── .keep
│ │ └── tasks
│ │ │ └── .keep
│ ├── log
│ │ └── .keep
│ ├── public
│ │ ├── 404.html
│ │ ├── 422.html
│ │ ├── 500.html
│ │ ├── favicon.ico
│ │ └── robots.txt
│ └── vendor
│ │ └── assets
│ │ ├── javascripts
│ │ └── .keep
│ │ └── stylesheets
│ │ └── .keep
└── search_csv_export_change_route_example
│ ├── .gitignore
│ ├── Gemfile
│ ├── Gemfile.lock
│ ├── README.rdoc
│ ├── Rakefile
│ ├── app
│ ├── assets
│ │ ├── images
│ │ │ └── .keep
│ │ ├── javascripts
│ │ │ ├── application.js
│ │ │ ├── bootstrap.js.coffee
│ │ │ ├── simple_search_form.js.coffee
│ │ │ └── tops.js.coffee
│ │ └── stylesheets
│ │ │ ├── application.css
│ │ │ ├── bootstrap_and_overrides.css.less
│ │ │ ├── scaffolds.css.scss
│ │ │ ├── simple_search_form.css.scss
│ │ │ └── tops.css.scss
│ ├── controllers
│ │ ├── application_controller.rb
│ │ ├── concerns
│ │ │ └── .keep
│ │ └── products_controller.rb
│ ├── decorators
│ │ ├── product_decorator.rb
│ │ └── products_decorator.rb
│ ├── helpers
│ │ ├── application_helper.rb
│ │ ├── simple_search_form_helper.rb
│ │ └── tops_helper.rb
│ ├── mailers
│ │ └── .keep
│ ├── models
│ │ ├── .keep
│ │ ├── concerns
│ │ │ ├── .keep
│ │ │ └── csv_exportable.rb
│ │ └── product.rb
│ └── views
│ │ ├── layouts
│ │ └── application.html.erb
│ │ ├── products
│ │ ├── _search_form.html.erb
│ │ ├── index.html.erb
│ │ └── search.html.erb
│ │ └── shared
│ │ ├── _search_box.html.erb
│ │ ├── _search_result_box.html.erb
│ │ └── _topnav_link.html.erb
│ ├── bin
│ ├── bundle
│ ├── rails
│ ├── rake
│ └── spring
│ ├── config.ru
│ ├── config
│ ├── application.rb
│ ├── boot.rb
│ ├── database.yml
│ ├── environment.rb
│ ├── environments
│ │ ├── development.rb
│ │ ├── production.rb
│ │ └── test.rb
│ ├── initializers
│ │ ├── backtrace_silencers.rb
│ │ ├── cookies_serializer.rb
│ │ ├── filter_parameter_logging.rb
│ │ ├── inflections.rb
│ │ ├── mime_types.rb
│ │ ├── session_store.rb
│ │ └── wrap_parameters.rb
│ ├── locales
│ │ ├── en.bootstrap.yml
│ │ ├── en.yml
│ │ └── ja.yml
│ ├── routes.rb
│ └── secrets.yml
│ ├── db
│ ├── migrate
│ │ └── 20141028082801_create_products.rb
│ ├── schema.rb
│ └── seeds.rb
│ ├── lib
│ ├── assets
│ │ └── .keep
│ └── tasks
│ │ └── .keep
│ ├── log
│ └── .keep
│ ├── public
│ ├── 404.html
│ ├── 422.html
│ ├── 500.html
│ ├── favicon.ico
│ └── robots.txt
│ └── vendor
│ └── assets
│ ├── javascripts
│ └── .keep
│ └── stylesheets
│ └── .keep
└── upload
└── carrierwave_file
├── .gitignore
├── Gemfile
├── Gemfile.lock
├── README.rdoc
├── Rakefile
├── app
├── assets
│ ├── images
│ │ └── .keep
│ ├── javascripts
│ │ ├── application.js
│ │ ├── bootstrap.js.coffee
│ │ └── products.js.coffee
│ └── stylesheets
│ │ ├── application.css
│ │ ├── bootstrap_and_overrides.css.less
│ │ ├── products.css.scss
│ │ └── scaffolds.css.scss
├── controllers
│ ├── application_controller.rb
│ ├── concerns
│ │ └── .keep
│ └── products_controller.rb
├── helpers
│ └── application_helper.rb
├── mailers
│ └── .keep
├── models
│ ├── .keep
│ ├── concerns
│ │ └── .keep
│ └── product.rb
├── uploaders
│ └── image_uploader.rb
└── views
│ ├── layouts
│ └── application.html.erb
│ ├── products
│ ├── _form.html.erb
│ ├── edit.html.erb
│ ├── index.html.erb
│ ├── new.html.erb
│ └── show.html.erb
│ └── shared
│ ├── _search_box.html.erb
│ ├── _search_result_box.html.erb
│ └── _topnav_link.html.erb
├── bin
├── bundle
├── rails
├── rake
├── setup
└── spring
├── config.ru
├── config
├── application.rb
├── boot.rb
├── environment.rb
├── environments
│ ├── development.rb
│ ├── production.rb
│ └── test.rb
├── initializers
│ ├── assets.rb
│ ├── backtrace_silencers.rb
│ ├── cookies_serializer.rb
│ ├── filter_parameter_logging.rb
│ ├── inflections.rb
│ ├── mime_types.rb
│ ├── session_store.rb
│ └── wrap_parameters.rb
├── locales
│ ├── en.yml
│ └── ja.yml
├── routes.rb
└── secrets.yml
├── db
├── migrate
│ └── 20150323160514_create_products.rb
├── schema.rb
└── seeds.rb
├── lib
├── assets
│ └── .keep
└── tasks
│ └── .keep
├── log
└── .keep
├── public
├── 404.html
├── 422.html
├── 500.html
├── favicon.ico
└── robots.txt
└── vendor
└── assets
├── javascripts
└── .keep
└── stylesheets
└── .keep
/.gitignore:
--------------------------------------------------------------------------------
1 | /test
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # rails-application-build-guide-sample
2 |
3 | Railsアプリケーション構築ガイド(http://rails.densan-labs.net) のサンプルアプリケーションです。
4 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2 | #
3 | # If you find yourself ignoring temporary files generated by your text editor
4 | # or operating system, you probably want to add a global ignore instead:
5 | # git config --global core.excludesfile '~/.gitignore_global'
6 |
7 | # Ignore bundler config.
8 | /.bundle
9 |
10 | # Ignore the default SQLite database.
11 | /db/*.sqlite3
12 | /db/*.sqlite3-journal
13 |
14 | # Ignore all logfiles and tempfiles.
15 | /log/*.log
16 | /tmp
17 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/Rakefile:
--------------------------------------------------------------------------------
1 | # Add your own tasks in files placed in lib/tasks ending in .rake,
2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3 |
4 | require File.expand_path('../config/application', __FILE__)
5 |
6 | Rails.application.load_tasks
7 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/app/assets/images/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/bulk_registration_form_example/app/assets/images/.keep
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/app/assets/javascripts/bootstrap.js.coffee:
--------------------------------------------------------------------------------
1 | jQuery ->
2 | $("a[rel~=popover], .has-popover").popover()
3 | $("a[rel~=tooltip], .has-tooltip").tooltip()
4 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/app/assets/javascripts/common.js.coffee:
--------------------------------------------------------------------------------
1 | $ ->
2 | $('.bulk-registration-form .form-control').change ->
3 | $(@)
4 | .parents('.item')
5 | .find('.registration-checkbox')
6 | .prop('checked', true)
7 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/app/assets/javascripts/simple_search_form.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/app/assets/javascripts/tops.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/app/assets/stylesheets/simple_search_form.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the SimpleSearchForm controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/app/assets/stylesheets/tops.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the Tops controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | class ApplicationController < ActionController::Base
2 | # Prevent CSRF attacks by raising an exception.
3 | # For APIs, you may want to use :null_session instead.
4 | protect_from_forgery with: :exception
5 | end
6 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/app/controllers/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/bulk_registration_form_example/app/controllers/concerns/.keep
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 | def navlink(title, path, current_controller, current_action)
3 | css_klass = ""
4 | if params[:controller] == current_controller.to_s && current_action.include?(params[:action].to_sym)
5 | css_klass = "active"
6 | end
7 | content_tag :li, class: css_klass do
8 | link_to title, path
9 | end
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/app/helpers/simple_search_form_helper.rb:
--------------------------------------------------------------------------------
1 | module SimpleSearchFormHelper
2 | end
3 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/app/mailers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/bulk_registration_form_example/app/mailers/.keep
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/app/models/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/bulk_registration_form_example/app/models/.keep
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/app/models/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/bulk_registration_form_example/app/models/concerns/.keep
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/app/models/form/base.rb:
--------------------------------------------------------------------------------
1 | class Form::Base
2 | include ActiveModel::Model
3 | include ActiveModel::Callbacks
4 | include ActiveModel::Validations
5 | include ActiveModel::Validations::Callbacks
6 |
7 | def value_to_boolean(value)
8 | ActiveRecord::ConnectionAdapters::Column.value_to_boolean(value)
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/app/models/validators/kana_validator.rb:
--------------------------------------------------------------------------------
1 | class KanaValidator < ActiveModel::EachValidator
2 | def validate_each(record, attribute, value)
3 | unless value =~ /\A([ァ-ヴーA-Za-z0-9\s]+)\z/
4 | record.errors[attribute] << (options[:message] || "はカタカナで入力してください")
5 | end
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/app/views/products/_errors.html.erb:
--------------------------------------------------------------------------------
1 | <% if form.products.any? { |product| product.errors.present? } %>
2 |
3 | <% form.products.each.with_index(1) do |product, idx| %>
4 | <% if product.errors.present? %>
5 |
6 | - <%= "#{idx}行目の商品レコードが不正です。" %>
7 |
8 | <% product.errors.full_messages.each do |error| %>
9 | - <%= error %>
10 | <% end %>
11 |
12 |
13 | <% end %>
14 | <% end %>
15 |
16 | <% end %>
17 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/app/views/products/index.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for(:title) do %>
2 | 商品検索
3 | <% end %>
4 |
5 | <%= search_form_for(@q, url: search_products_path, html: { method: :get, class: 'form-horizontal', role: 'form' }) do |f| %>
6 | <%= render 'search_form', f: f %>
7 | <% end %>
8 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/app/views/shared/_search_box.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
検索条件
4 |
5 |
6 | <%= yield %>
7 |
8 |
9 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/app/views/shared/_search_result_box.html.erb:
--------------------------------------------------------------------------------
1 | 検索結果
2 | <%= yield %>
3 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/app/views/shared/_topnav_link.html.erb:
--------------------------------------------------------------------------------
1 | <%= navlink('商品検索', products_path, :products, [:index, :search]) %>
2 | <%= navlink('商品一括登録', new_product_path, :products, [:new, :create]) %>
3 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 | load Gem.bin_path('bundler', 'bundle')
4 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | APP_PATH = File.expand_path('../../config/application', __FILE__)
7 | require_relative '../config/boot'
8 | require 'rails/commands'
9 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | require_relative '../config/boot'
7 | require 'rake'
8 | Rake.application.run
9 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/config.ru:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require ::File.expand_path('../config/environment', __FILE__)
4 | run Rails.application
5 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/config/boot.rb:
--------------------------------------------------------------------------------
1 | # Set up gems listed in the Gemfile.
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 |
4 | require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require File.expand_path('../application', __FILE__)
3 |
4 | # Initialize the Rails application.
5 | Rails.application.initialize!
6 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5 |
6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7 | # Rails.backtrace_cleaner.remove_silencers!
8 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.action_dispatch.cookies_serializer = :json
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Configure sensitive parameters which will be filtered from the log file.
4 | Rails.application.config.filter_parameters += [:password]
5 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new mime types for use in respond_to blocks:
4 | # Mime::Type.register "text/richtext", :rtf
5 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/config/initializers/session_store.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.session_store :cookie_store, key: '_form_example_session'
4 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/config/routes.rb:
--------------------------------------------------------------------------------
1 | Rails.application.routes.draw do
2 | root 'products#index'
3 |
4 | resources :products, only: [:index, :new, :create] do
5 | collection do
6 | get :search
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/lib/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/bulk_registration_form_example/lib/assets/.keep
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/lib/tasks/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/bulk_registration_form_example/lib/tasks/.keep
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/log/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/bulk_registration_form_example/log/.keep
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/bulk_registration_form_example/public/favicon.ico
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2 | #
3 | # To ban all spiders from the entire site uncomment the next two lines:
4 | # User-agent: *
5 | # Disallow: /
6 |
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/vendor/assets/javascripts/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/bulk_registration_form_example/vendor/assets/javascripts/.keep
--------------------------------------------------------------------------------
/form/bulk_registration_form_example/vendor/assets/stylesheets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/bulk_registration_form_example/vendor/assets/stylesheets/.keep
--------------------------------------------------------------------------------
/form/datetime_forms/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2 | #
3 | # If you find yourself ignoring temporary files generated by your text editor
4 | # or operating system, you probably want to add a global ignore instead:
5 | # git config --global core.excludesfile '~/.gitignore_global'
6 |
7 | # Ignore bundler config.
8 | /.bundle
9 |
10 | # Ignore the default SQLite database.
11 | /db/*.sqlite3
12 | /db/*.sqlite3-journal
13 |
14 | # Ignore all logfiles and tempfiles.
15 | /log/*.log
16 | /tmp
17 |
--------------------------------------------------------------------------------
/form/datetime_forms/Rakefile:
--------------------------------------------------------------------------------
1 | # Add your own tasks in files placed in lib/tasks ending in .rake,
2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3 |
4 | require File.expand_path('../config/application', __FILE__)
5 |
6 | Rails.application.load_tasks
7 |
--------------------------------------------------------------------------------
/form/datetime_forms/app/assets/images/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/datetime_forms/app/assets/images/.keep
--------------------------------------------------------------------------------
/form/datetime_forms/app/assets/javascripts/bootstrap.js.coffee:
--------------------------------------------------------------------------------
1 | jQuery ->
2 | $("a[rel~=popover], .has-popover").popover()
3 | $("a[rel~=tooltip], .has-tooltip").tooltip()
4 |
--------------------------------------------------------------------------------
/form/datetime_forms/app/assets/javascripts/common.js.coffee:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/datetime_forms/app/assets/javascripts/common.js.coffee
--------------------------------------------------------------------------------
/form/datetime_forms/app/assets/javascripts/simple_search_form.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/form/datetime_forms/app/assets/javascripts/tops.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/form/datetime_forms/app/assets/stylesheets/simple_search_form.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the SimpleSearchForm controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/form/datetime_forms/app/assets/stylesheets/tops.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the Tops controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/form/datetime_forms/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | class ApplicationController < ActionController::Base
2 | # Prevent CSRF attacks by raising an exception.
3 | # For APIs, you may want to use :null_session instead.
4 | protect_from_forgery with: :exception
5 | end
6 |
--------------------------------------------------------------------------------
/form/datetime_forms/app/controllers/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/datetime_forms/app/controllers/concerns/.keep
--------------------------------------------------------------------------------
/form/datetime_forms/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 | def navlink(title, path, current_controller, current_action)
3 | css_klass = ""
4 | if params[:controller] == current_controller.to_s && current_action.include?(params[:action].to_sym)
5 | css_klass = "active"
6 | end
7 | content_tag :li, class: css_klass do
8 | link_to title, path
9 | end
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/form/datetime_forms/app/helpers/orders_helper.rb:
--------------------------------------------------------------------------------
1 | module OrdersHelper
2 | end
3 |
--------------------------------------------------------------------------------
/form/datetime_forms/app/helpers/simple_search_form_helper.rb:
--------------------------------------------------------------------------------
1 | module SimpleSearchFormHelper
2 | end
3 |
--------------------------------------------------------------------------------
/form/datetime_forms/app/helpers/tops_helper.rb:
--------------------------------------------------------------------------------
1 | module TopsHelper
2 | end
3 |
--------------------------------------------------------------------------------
/form/datetime_forms/app/mailers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/datetime_forms/app/mailers/.keep
--------------------------------------------------------------------------------
/form/datetime_forms/app/models/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/datetime_forms/app/models/.keep
--------------------------------------------------------------------------------
/form/datetime_forms/app/models/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/datetime_forms/app/models/concerns/.keep
--------------------------------------------------------------------------------
/form/datetime_forms/app/views/products/edit.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for(:title) do %>
2 | 商品更新
3 | <% end %>
4 |
5 | <%= render 'form', path: product_path(@product), method: :put %>
6 |
--------------------------------------------------------------------------------
/form/datetime_forms/app/views/products/new.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for(:title) do %>
2 | 商品登録
3 | <% end %>
4 |
5 | <%= render 'form', path: products_path, method: :post %>
6 |
--------------------------------------------------------------------------------
/form/datetime_forms/app/views/shared/_search_box.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
検索条件
4 |
5 |
6 | <%= yield %>
7 |
8 |
9 |
--------------------------------------------------------------------------------
/form/datetime_forms/app/views/shared/_search_result_box.html.erb:
--------------------------------------------------------------------------------
1 | 検索結果
2 | <%= yield %>
3 |
--------------------------------------------------------------------------------
/form/datetime_forms/app/views/shared/_topnav_link.html.erb:
--------------------------------------------------------------------------------
1 | <%= navlink('商品一覧', products_path, :products, [:index]) %>
2 | <%= navlink('商品登録', new_product_path, :products, [:new, :create, :edit, :update]) %>
3 |
--------------------------------------------------------------------------------
/form/datetime_forms/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 | load Gem.bin_path('bundler', 'bundle')
4 |
--------------------------------------------------------------------------------
/form/datetime_forms/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | APP_PATH = File.expand_path('../../config/application', __FILE__)
7 | require_relative '../config/boot'
8 | require 'rails/commands'
9 |
--------------------------------------------------------------------------------
/form/datetime_forms/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | require_relative '../config/boot'
7 | require 'rake'
8 | Rake.application.run
9 |
--------------------------------------------------------------------------------
/form/datetime_forms/config.ru:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require ::File.expand_path('../config/environment', __FILE__)
4 | run Rails.application
5 |
--------------------------------------------------------------------------------
/form/datetime_forms/config/boot.rb:
--------------------------------------------------------------------------------
1 | # Set up gems listed in the Gemfile.
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 |
4 | require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5 |
--------------------------------------------------------------------------------
/form/datetime_forms/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require File.expand_path('../application', __FILE__)
3 |
4 | # Initialize the Rails application.
5 | Rails.application.initialize!
6 |
--------------------------------------------------------------------------------
/form/datetime_forms/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5 |
6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7 | # Rails.backtrace_cleaner.remove_silencers!
8 |
--------------------------------------------------------------------------------
/form/datetime_forms/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.action_dispatch.cookies_serializer = :json
--------------------------------------------------------------------------------
/form/datetime_forms/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Configure sensitive parameters which will be filtered from the log file.
4 | Rails.application.config.filter_parameters += [:password]
5 |
--------------------------------------------------------------------------------
/form/datetime_forms/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new mime types for use in respond_to blocks:
4 | # Mime::Type.register "text/richtext", :rtf
5 |
--------------------------------------------------------------------------------
/form/datetime_forms/config/initializers/session_store.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.session_store :cookie_store, key: '_form_example_session'
4 |
--------------------------------------------------------------------------------
/form/datetime_forms/config/routes.rb:
--------------------------------------------------------------------------------
1 | Rails.application.routes.draw do
2 | root 'products#index'
3 |
4 | resources :products do
5 | collection do
6 | get :search
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/form/datetime_forms/db/migrate/20141028082801_create_products.rb:
--------------------------------------------------------------------------------
1 | class CreateProducts < ActiveRecord::Migration
2 | def change
3 | create_table :products do |t|
4 | t.comment '商品'
5 | t.string :name, limit: 50, null: false, comment: '商品名'
6 | t.date :arrival_date, null: false, comment: '入荷予定日'
7 | t.datetime :published_at, null: false, comment: '公開予定日時'
8 |
9 | t.timestamps null: false
10 | end
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/form/datetime_forms/db/seeds.rb:
--------------------------------------------------------------------------------
1 | products = [
2 | {
3 | name: 'A製造アルミケースRSDI001',
4 | arrival_date: '2015/10/06',
5 | published_at: '2015/10/10 12:00'
6 | }
7 | ]
8 |
9 | Product.create(products)
10 |
--------------------------------------------------------------------------------
/form/datetime_forms/lib/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/datetime_forms/lib/assets/.keep
--------------------------------------------------------------------------------
/form/datetime_forms/lib/tasks/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/datetime_forms/lib/tasks/.keep
--------------------------------------------------------------------------------
/form/datetime_forms/log/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/datetime_forms/log/.keep
--------------------------------------------------------------------------------
/form/datetime_forms/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/datetime_forms/public/favicon.ico
--------------------------------------------------------------------------------
/form/datetime_forms/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2 | #
3 | # To ban all spiders from the entire site uncomment the next two lines:
4 | # User-agent: *
5 | # Disallow: /
6 |
--------------------------------------------------------------------------------
/form/datetime_forms/vendor/assets/javascripts/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/datetime_forms/vendor/assets/javascripts/.keep
--------------------------------------------------------------------------------
/form/datetime_forms/vendor/assets/stylesheets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/datetime_forms/vendor/assets/stylesheets/.keep
--------------------------------------------------------------------------------
/form/datetime_js_forms/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2 | #
3 | # If you find yourself ignoring temporary files generated by your text editor
4 | # or operating system, you probably want to add a global ignore instead:
5 | # git config --global core.excludesfile '~/.gitignore_global'
6 |
7 | # Ignore bundler config.
8 | /.bundle
9 |
10 | # Ignore the default SQLite database.
11 | /db/*.sqlite3
12 | /db/*.sqlite3-journal
13 |
14 | # Ignore all logfiles and tempfiles.
15 | /log/*.log
16 | /tmp
17 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/Rakefile:
--------------------------------------------------------------------------------
1 | # Add your own tasks in files placed in lib/tasks ending in .rake,
2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3 |
4 | require File.expand_path('../config/application', __FILE__)
5 |
6 | Rails.application.load_tasks
7 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/app/assets/images/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/datetime_js_forms/app/assets/images/.keep
--------------------------------------------------------------------------------
/form/datetime_js_forms/app/assets/javascripts/bootstrap.js.coffee:
--------------------------------------------------------------------------------
1 | jQuery ->
2 | $("a[rel~=popover], .has-popover").popover()
3 | $("a[rel~=tooltip], .has-tooltip").tooltip()
4 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/app/assets/javascripts/common.js.coffee:
--------------------------------------------------------------------------------
1 | $ ->
2 | $('.datetime-picker').datetimepicker()
3 | $('.date-picker').datetimepicker(pickTime: false)
4 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/app/assets/javascripts/simple_search_form.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/app/assets/javascripts/tops.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/app/assets/stylesheets/simple_search_form.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the SimpleSearchForm controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/app/assets/stylesheets/tops.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the Tops controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | class ApplicationController < ActionController::Base
2 | # Prevent CSRF attacks by raising an exception.
3 | # For APIs, you may want to use :null_session instead.
4 | protect_from_forgery with: :exception
5 | end
6 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/app/controllers/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/datetime_js_forms/app/controllers/concerns/.keep
--------------------------------------------------------------------------------
/form/datetime_js_forms/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 | def navlink(title, path, current_controller, current_action)
3 | css_klass = ""
4 | if params[:controller] == current_controller.to_s && current_action.include?(params[:action].to_sym)
5 | css_klass = "active"
6 | end
7 | content_tag :li, class: css_klass do
8 | link_to title, path
9 | end
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/app/helpers/orders_helper.rb:
--------------------------------------------------------------------------------
1 | module OrdersHelper
2 | end
3 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/app/helpers/simple_search_form_helper.rb:
--------------------------------------------------------------------------------
1 | module SimpleSearchFormHelper
2 | end
3 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/app/helpers/tops_helper.rb:
--------------------------------------------------------------------------------
1 | module TopsHelper
2 | end
3 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/app/mailers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/datetime_js_forms/app/mailers/.keep
--------------------------------------------------------------------------------
/form/datetime_js_forms/app/models/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/datetime_js_forms/app/models/.keep
--------------------------------------------------------------------------------
/form/datetime_js_forms/app/models/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/datetime_js_forms/app/models/concerns/.keep
--------------------------------------------------------------------------------
/form/datetime_js_forms/app/views/products/edit.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for(:title) do %>
2 | 商品更新
3 | <% end %>
4 |
5 | <%= render 'form', path: product_path(@product), method: :put %>
6 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/app/views/products/new.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for(:title) do %>
2 | 商品登録
3 | <% end %>
4 |
5 | <%= render 'form', path: products_path, method: :post %>
6 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/app/views/shared/_search_box.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
検索条件
4 |
5 |
6 | <%= yield %>
7 |
8 |
9 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/app/views/shared/_search_result_box.html.erb:
--------------------------------------------------------------------------------
1 | 検索結果
2 | <%= yield %>
3 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/app/views/shared/_topnav_link.html.erb:
--------------------------------------------------------------------------------
1 | <%= navlink('商品一覧', products_path, :products, [:index]) %>
2 | <%= navlink('商品登録', new_product_path, :products, [:new, :create, :edit, :update]) %>
3 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 | load Gem.bin_path('bundler', 'bundle')
4 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | APP_PATH = File.expand_path('../../config/application', __FILE__)
7 | require_relative '../config/boot'
8 | require 'rails/commands'
9 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | require_relative '../config/boot'
7 | require 'rake'
8 | Rake.application.run
9 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/config.ru:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require ::File.expand_path('../config/environment', __FILE__)
4 | run Rails.application
5 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/config/boot.rb:
--------------------------------------------------------------------------------
1 | # Set up gems listed in the Gemfile.
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 |
4 | require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require File.expand_path('../application', __FILE__)
3 |
4 | # Initialize the Rails application.
5 | Rails.application.initialize!
6 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5 |
6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7 | # Rails.backtrace_cleaner.remove_silencers!
8 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.action_dispatch.cookies_serializer = :json
--------------------------------------------------------------------------------
/form/datetime_js_forms/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Configure sensitive parameters which will be filtered from the log file.
4 | Rails.application.config.filter_parameters += [:password]
5 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new mime types for use in respond_to blocks:
4 | # Mime::Type.register "text/richtext", :rtf
5 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/config/initializers/session_store.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.session_store :cookie_store, key: '_form_example_session'
4 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/config/routes.rb:
--------------------------------------------------------------------------------
1 | Rails.application.routes.draw do
2 | root 'products#index'
3 |
4 | resources :products do
5 | collection do
6 | get :search
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/db/migrate/20141028082801_create_products.rb:
--------------------------------------------------------------------------------
1 | class CreateProducts < ActiveRecord::Migration
2 | def change
3 | create_table :products do |t|
4 | t.comment '商品'
5 | t.string :name, limit: 50, null: false, comment: '商品名'
6 | t.date :arrival_date, null: false, comment: '入荷予定日'
7 | t.datetime :published_at, null: false, comment: '公開予定日時'
8 |
9 | t.timestamps null: false
10 | end
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/db/seeds.rb:
--------------------------------------------------------------------------------
1 | products = [
2 | {
3 | name: 'A製造アルミケースRSDI001',
4 | arrival_date: '2015/10/06',
5 | published_at: '2015/10/10 12:00'
6 | }
7 | ]
8 |
9 | Product.create(products)
10 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/lib/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/datetime_js_forms/lib/assets/.keep
--------------------------------------------------------------------------------
/form/datetime_js_forms/lib/tasks/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/datetime_js_forms/lib/tasks/.keep
--------------------------------------------------------------------------------
/form/datetime_js_forms/log/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/datetime_js_forms/log/.keep
--------------------------------------------------------------------------------
/form/datetime_js_forms/public/assets/twitter/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/datetime_js_forms/public/assets/twitter/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/form/datetime_js_forms/public/assets/twitter/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/datetime_js_forms/public/assets/twitter/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/form/datetime_js_forms/public/assets/twitter/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/datetime_js_forms/public/assets/twitter/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/form/datetime_js_forms/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/datetime_js_forms/public/favicon.ico
--------------------------------------------------------------------------------
/form/datetime_js_forms/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2 | #
3 | # To ban all spiders from the entire site uncomment the next two lines:
4 | # User-agent: *
5 | # Disallow: /
6 |
--------------------------------------------------------------------------------
/form/datetime_js_forms/vendor/assets/javascripts/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/datetime_js_forms/vendor/assets/javascripts/.keep
--------------------------------------------------------------------------------
/form/datetime_js_forms/vendor/assets/stylesheets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/datetime_js_forms/vendor/assets/stylesheets/.keep
--------------------------------------------------------------------------------
/form/double_submit_protection/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2 | #
3 | # If you find yourself ignoring temporary files generated by your text editor
4 | # or operating system, you probably want to add a global ignore instead:
5 | # git config --global core.excludesfile '~/.gitignore_global'
6 |
7 | # Ignore bundler config.
8 | /.bundle
9 |
10 | # Ignore the default SQLite database.
11 | /db/*.sqlite3
12 | /db/*.sqlite3-journal
13 |
14 | # Ignore all logfiles and tempfiles.
15 | /log/*.log
16 | /tmp
17 |
--------------------------------------------------------------------------------
/form/double_submit_protection/Rakefile:
--------------------------------------------------------------------------------
1 | # Add your own tasks in files placed in lib/tasks ending in .rake,
2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3 |
4 | require File.expand_path('../config/application', __FILE__)
5 |
6 | Rails.application.load_tasks
7 |
--------------------------------------------------------------------------------
/form/double_submit_protection/app/assets/images/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/double_submit_protection/app/assets/images/.keep
--------------------------------------------------------------------------------
/form/double_submit_protection/app/assets/javascripts/bootstrap.js.coffee:
--------------------------------------------------------------------------------
1 | jQuery ->
2 | $("a[rel~=popover], .has-popover").popover()
3 | $("a[rel~=tooltip], .has-tooltip").tooltip()
4 |
--------------------------------------------------------------------------------
/form/double_submit_protection/app/assets/javascripts/common.js.coffee:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/form/double_submit_protection/app/assets/javascripts/contacts.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/form/double_submit_protection/app/assets/stylesheets/contacts.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the Contacts controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/form/double_submit_protection/app/assets/stylesheets/simple_search_form.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the SimpleSearchForm controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/form/double_submit_protection/app/assets/stylesheets/tops.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the Tops controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/form/double_submit_protection/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | class ApplicationController < ActionController::Base
2 | # Prevent CSRF attacks by raising an exception.
3 | # For APIs, you may want to use :null_session instead.
4 | protect_from_forgery with: :exception
5 | end
6 |
--------------------------------------------------------------------------------
/form/double_submit_protection/app/controllers/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/double_submit_protection/app/controllers/concerns/.keep
--------------------------------------------------------------------------------
/form/double_submit_protection/app/controllers/contacts_controller.rb:
--------------------------------------------------------------------------------
1 | class ContactsController < ApplicationController
2 | def index
3 | end
4 |
5 | def new
6 | @contact = Contact.new
7 | end
8 |
9 | def create
10 | @contact = Contact.new(contact_params)
11 | if @contact.save
12 | redirect_to contacts_path,
13 | notice: 'ご意見・ご感想をお寄せいただき、ありがとうございました。'
14 | else
15 | render :new
16 | end
17 | end
18 |
19 | private
20 |
21 | def contact_params
22 | params.require(:contact).permit(:name, :content)
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/form/double_submit_protection/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 | def navlink(title, path, current_controller, current_action)
3 | css_klass = ""
4 | if params[:controller] == current_controller.to_s && current_action.include?(params[:action].to_sym)
5 | css_klass = "active"
6 | end
7 | content_tag :li, class: css_klass do
8 | link_to title, path
9 | end
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/form/double_submit_protection/app/helpers/contacts_helper.rb:
--------------------------------------------------------------------------------
1 | module ContactsHelper
2 | end
3 |
--------------------------------------------------------------------------------
/form/double_submit_protection/app/helpers/orders_helper.rb:
--------------------------------------------------------------------------------
1 | module OrdersHelper
2 | end
3 |
--------------------------------------------------------------------------------
/form/double_submit_protection/app/helpers/simple_search_form_helper.rb:
--------------------------------------------------------------------------------
1 | module SimpleSearchFormHelper
2 | end
3 |
--------------------------------------------------------------------------------
/form/double_submit_protection/app/helpers/tops_helper.rb:
--------------------------------------------------------------------------------
1 | module TopsHelper
2 | end
3 |
--------------------------------------------------------------------------------
/form/double_submit_protection/app/mailers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/double_submit_protection/app/mailers/.keep
--------------------------------------------------------------------------------
/form/double_submit_protection/app/models/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/double_submit_protection/app/models/.keep
--------------------------------------------------------------------------------
/form/double_submit_protection/app/models/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/double_submit_protection/app/models/concerns/.keep
--------------------------------------------------------------------------------
/form/double_submit_protection/app/models/contact.rb:
--------------------------------------------------------------------------------
1 | # == Schema Information
2 | #
3 | # Table name: contacts
4 | #
5 | # id :integer not null, primary key
6 | # name :string(255)
7 | # content :text
8 | # created_at :datetime
9 | # updated_at :datetime
10 | #
11 |
12 | class Contact < ActiveRecord::Base
13 | end
14 |
--------------------------------------------------------------------------------
/form/double_submit_protection/app/views/contacts/index.html.erb:
--------------------------------------------------------------------------------
1 | 問い合わせ
2 |
3 | 本システムに関する、ご意見、ご感想をお寄せください
4 |
5 | <%= link_to '意見を送る', new_contact_path, class: 'btn btn-default' %>
6 |
--------------------------------------------------------------------------------
/form/double_submit_protection/app/views/shared/_topnav_link.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/form/double_submit_protection/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 | load Gem.bin_path('bundler', 'bundle')
4 |
--------------------------------------------------------------------------------
/form/double_submit_protection/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | APP_PATH = File.expand_path('../../config/application', __FILE__)
7 | require_relative '../config/boot'
8 | require 'rails/commands'
9 |
--------------------------------------------------------------------------------
/form/double_submit_protection/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | require_relative '../config/boot'
7 | require 'rake'
8 | Rake.application.run
9 |
--------------------------------------------------------------------------------
/form/double_submit_protection/config.ru:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require ::File.expand_path('../config/environment', __FILE__)
4 | run Rails.application
5 |
--------------------------------------------------------------------------------
/form/double_submit_protection/config/boot.rb:
--------------------------------------------------------------------------------
1 | # Set up gems listed in the Gemfile.
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 |
4 | require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5 |
--------------------------------------------------------------------------------
/form/double_submit_protection/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require File.expand_path('../application', __FILE__)
3 |
4 | # Initialize the Rails application.
5 | Rails.application.initialize!
6 |
--------------------------------------------------------------------------------
/form/double_submit_protection/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5 |
6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7 | # Rails.backtrace_cleaner.remove_silencers!
8 |
--------------------------------------------------------------------------------
/form/double_submit_protection/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.action_dispatch.cookies_serializer = :json
--------------------------------------------------------------------------------
/form/double_submit_protection/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Configure sensitive parameters which will be filtered from the log file.
4 | Rails.application.config.filter_parameters += [:password]
5 |
--------------------------------------------------------------------------------
/form/double_submit_protection/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new mime types for use in respond_to blocks:
4 | # Mime::Type.register "text/richtext", :rtf
5 |
--------------------------------------------------------------------------------
/form/double_submit_protection/config/initializers/session_store.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.session_store :cookie_store, key: '_form_example_session'
4 |
--------------------------------------------------------------------------------
/form/double_submit_protection/config/routes.rb:
--------------------------------------------------------------------------------
1 | Rails.application.routes.draw do
2 | root 'contacts#index'
3 |
4 | resources :contacts, only: [:index, :new, :create]
5 | end
6 |
--------------------------------------------------------------------------------
/form/double_submit_protection/config/unicorn.rb:
--------------------------------------------------------------------------------
1 | worker_processes 4
2 | timeout 30
3 |
--------------------------------------------------------------------------------
/form/double_submit_protection/db/migrate/20141116091300_create_contacts.rb:
--------------------------------------------------------------------------------
1 | class CreateContacts < ActiveRecord::Migration
2 | def change
3 | create_table :contacts do |t|
4 | t.string :name
5 | t.text :content
6 |
7 | t.timestamps
8 | end
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/form/double_submit_protection/db/seeds.rb:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/form/double_submit_protection/exec_server.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | bundle exec unicorn_rails -c config/unicorn.rb -p 3000 -E development
3 |
--------------------------------------------------------------------------------
/form/double_submit_protection/lib/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/double_submit_protection/lib/assets/.keep
--------------------------------------------------------------------------------
/form/double_submit_protection/lib/tasks/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/double_submit_protection/lib/tasks/.keep
--------------------------------------------------------------------------------
/form/double_submit_protection/log/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/double_submit_protection/log/.keep
--------------------------------------------------------------------------------
/form/double_submit_protection/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/double_submit_protection/public/favicon.ico
--------------------------------------------------------------------------------
/form/double_submit_protection/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2 | #
3 | # To ban all spiders from the entire site uncomment the next two lines:
4 | # User-agent: *
5 | # Disallow: /
6 |
--------------------------------------------------------------------------------
/form/double_submit_protection/vendor/assets/javascripts/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/double_submit_protection/vendor/assets/javascripts/.keep
--------------------------------------------------------------------------------
/form/double_submit_protection/vendor/assets/stylesheets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/double_submit_protection/vendor/assets/stylesheets/.keep
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2 | #
3 | # If you find yourself ignoring temporary files generated by your text editor
4 | # or operating system, you probably want to add a global ignore instead:
5 | # git config --global core.excludesfile '~/.gitignore_global'
6 |
7 | # Ignore bundler config.
8 | /.bundle
9 |
10 | # Ignore the default SQLite database.
11 | /db/*.sqlite3
12 | /db/*.sqlite3-journal
13 |
14 | # Ignore all logfiles and tempfiles.
15 | /log/*.log
16 | /tmp
17 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/Rakefile:
--------------------------------------------------------------------------------
1 | # Add your own tasks in files placed in lib/tasks ending in .rake,
2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3 |
4 | require File.expand_path('../config/application', __FILE__)
5 |
6 | Rails.application.load_tasks
7 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/app/assets/images/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/dynamic_nested_forms/app/assets/images/.keep
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/app/assets/javascripts/bootstrap.js.coffee:
--------------------------------------------------------------------------------
1 | jQuery ->
2 | $("a[rel~=popover], .has-popover").popover()
3 | $("a[rel~=tooltip], .has-tooltip").tooltip()
4 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/app/assets/javascripts/simple_search_form.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/app/assets/javascripts/tops.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/app/assets/stylesheets/simple_search_form.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the SimpleSearchForm controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/app/assets/stylesheets/tops.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the Tops controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | class ApplicationController < ActionController::Base
2 | # Prevent CSRF attacks by raising an exception.
3 | # For APIs, you may want to use :null_session instead.
4 | protect_from_forgery with: :exception
5 | end
6 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/app/controllers/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/dynamic_nested_forms/app/controllers/concerns/.keep
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 | def navlink(title, path, current_controller, current_action)
3 | css_klass = ""
4 | if params[:controller] == current_controller.to_s && current_action.include?(params[:action].to_sym)
5 | css_klass = "active"
6 | end
7 | content_tag :li, class: css_klass do
8 | link_to title, path
9 | end
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/app/helpers/orders_helper.rb:
--------------------------------------------------------------------------------
1 | module OrdersHelper
2 | end
3 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/app/helpers/simple_search_form_helper.rb:
--------------------------------------------------------------------------------
1 | module SimpleSearchFormHelper
2 | end
3 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/app/helpers/tops_helper.rb:
--------------------------------------------------------------------------------
1 | module TopsHelper
2 | end
3 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/app/mailers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/dynamic_nested_forms/app/mailers/.keep
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/app/models/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/dynamic_nested_forms/app/models/.keep
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/app/models/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/dynamic_nested_forms/app/models/concerns/.keep
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/app/models/corporation.rb:
--------------------------------------------------------------------------------
1 | # == Schema Information
2 | #
3 | # Table name: corporations # 法人
4 | #
5 | # id :integer not null, primary key
6 | # name :string(100) not null # 名称
7 | # name_kana :string(100) not null # 名称カナ
8 | # created_at :datetime not null
9 | # updated_at :datetime not null
10 | #
11 |
12 | class Corporation < ActiveRecord::Base
13 | end
14 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/app/views/orders/edit.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for(:title) do %>
2 | 受注編集
3 | <% end %>
4 |
5 | <%= render 'form', path: order_path(@order), method: :put %>
6 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/app/views/orders/index.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for(:title) do %>
2 | 受注一覧
3 | <% end %>
4 |
5 | <%= search_form_for(@q, url: search_orders_path, html: { method: :get, class: 'form-horizontal', role: 'form' }) do |f| %>
6 | <%= render 'search_form', f: f %>
7 | <% end %>
8 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/app/views/orders/new.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for(:title) do %>
2 | 受注登録
3 | <% end %>
4 |
5 | <%= render 'form', path: orders_path, method: :post %>
6 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/app/views/orders/show.html.erb:
--------------------------------------------------------------------------------
1 | <%= notice %>
2 |
3 | <%= link_to 'Edit', edit_order_path(@order) %> |
4 | <%= link_to 'Back', orders_path %>
5 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/app/views/products/index.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for(:title) do %>
2 | 商品検索
3 | <% end %>
4 |
5 | <%= search_form_for(@q, url: search_products_path, html: { method: :get, class: 'form-horizontal', role: 'form' }) do |f| %>
6 | <%= render 'search_form', f: f %>
7 | <% end %>
8 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/app/views/shared/_search_box.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
検索条件
4 |
5 |
6 | <%= yield %>
7 |
8 |
9 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/app/views/shared/_search_result_box.html.erb:
--------------------------------------------------------------------------------
1 | 検索結果
2 | <%= yield %>
3 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/app/views/shared/_topnav_link.html.erb:
--------------------------------------------------------------------------------
1 | <%= navlink('商品検索', products_path, :products, [:index, :search]) %>
2 | <%= navlink('受注一覧', orders_path, :orders, [:index, :search]) %>
3 | <%= navlink('受注登録', new_order_path, :orders, [:new, :create, :edit, :update]) %>
4 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 | load Gem.bin_path('bundler', 'bundle')
4 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | APP_PATH = File.expand_path('../../config/application', __FILE__)
7 | require_relative '../config/boot'
8 | require 'rails/commands'
9 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | require_relative '../config/boot'
7 | require 'rake'
8 | Rake.application.run
9 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/config.ru:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require ::File.expand_path('../config/environment', __FILE__)
4 | run Rails.application
5 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/config/boot.rb:
--------------------------------------------------------------------------------
1 | # Set up gems listed in the Gemfile.
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 |
4 | require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require File.expand_path('../application', __FILE__)
3 |
4 | # Initialize the Rails application.
5 | Rails.application.initialize!
6 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5 |
6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7 | # Rails.backtrace_cleaner.remove_silencers!
8 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.action_dispatch.cookies_serializer = :json
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Configure sensitive parameters which will be filtered from the log file.
4 | Rails.application.config.filter_parameters += [:password]
5 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new mime types for use in respond_to blocks:
4 | # Mime::Type.register "text/richtext", :rtf
5 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/config/initializers/session_store.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.session_store :cookie_store, key: '_form_example_session'
4 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/config/routes.rb:
--------------------------------------------------------------------------------
1 | Rails.application.routes.draw do
2 | root 'products#index'
3 |
4 | resources :products, only: [:index] do
5 | collection do
6 | get :search
7 | end
8 | end
9 |
10 | resources :orders do
11 | collection do
12 | get :search
13 | end
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/db/migrate/20141031055542_create_corporations.rb:
--------------------------------------------------------------------------------
1 | class CreateCorporations < ActiveRecord::Migration
2 | def change
3 | create_table :corporations do |t|
4 | t.comment '法人'
5 | t.string :name, limit: 100, null: false, comment: '名称'
6 | t.string :name_kana, limit: 100, null: false, comment: '名称カナ'
7 |
8 | t.timestamps null: false
9 | end
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/db/migrate/20141031055711_create_orders.rb:
--------------------------------------------------------------------------------
1 | class CreateOrders < ActiveRecord::Migration
2 | def change
3 | create_table :orders do |t|
4 | t.comment '注文'
5 | t.string :name, limit: 100, null: false, comment: '注文名称'
6 | t.integer :corporation_id, null: false, comment: '取引先'
7 | t.decimal :price, null: false, comment: '合計金額'
8 |
9 | t.timestamps null: false
10 |
11 | t.foreign_key :corporations
12 | end
13 | end
14 | end
15 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/lib/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/dynamic_nested_forms/lib/assets/.keep
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/lib/tasks/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/dynamic_nested_forms/lib/tasks/.keep
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/log/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/dynamic_nested_forms/log/.keep
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/dynamic_nested_forms/public/favicon.ico
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2 | #
3 | # To ban all spiders from the entire site uncomment the next two lines:
4 | # User-agent: *
5 | # Disallow: /
6 |
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/vendor/assets/javascripts/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/dynamic_nested_forms/vendor/assets/javascripts/.keep
--------------------------------------------------------------------------------
/form/dynamic_nested_forms/vendor/assets/stylesheets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/dynamic_nested_forms/vendor/assets/stylesheets/.keep
--------------------------------------------------------------------------------
/form/form_object_example/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2 | #
3 | # If you find yourself ignoring temporary files generated by your text editor
4 | # or operating system, you probably want to add a global ignore instead:
5 | # git config --global core.excludesfile '~/.gitignore_global'
6 |
7 | # Ignore bundler config.
8 | /.bundle
9 |
10 | # Ignore the default SQLite database.
11 | /db/*.sqlite3
12 | /db/*.sqlite3-journal
13 |
14 | # Ignore all logfiles and tempfiles.
15 | /log/*.log
16 | /tmp
17 |
--------------------------------------------------------------------------------
/form/form_object_example/Rakefile:
--------------------------------------------------------------------------------
1 | # Add your own tasks in files placed in lib/tasks ending in .rake,
2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3 |
4 | require File.expand_path('../config/application', __FILE__)
5 |
6 | Rails.application.load_tasks
7 |
--------------------------------------------------------------------------------
/form/form_object_example/app/assets/images/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/form_object_example/app/assets/images/.keep
--------------------------------------------------------------------------------
/form/form_object_example/app/assets/javascripts/bootstrap.js.coffee:
--------------------------------------------------------------------------------
1 | jQuery ->
2 | $("a[rel~=popover], .has-popover").popover()
3 | $("a[rel~=tooltip], .has-tooltip").tooltip()
4 |
--------------------------------------------------------------------------------
/form/form_object_example/app/assets/javascripts/simple_search_form.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/form/form_object_example/app/assets/javascripts/tops.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/form/form_object_example/app/assets/stylesheets/simple_search_form.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the SimpleSearchForm controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/form/form_object_example/app/assets/stylesheets/tops.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the Tops controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/form/form_object_example/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | class ApplicationController < ActionController::Base
2 | # Prevent CSRF attacks by raising an exception.
3 | # For APIs, you may want to use :null_session instead.
4 | protect_from_forgery with: :exception
5 | end
6 |
--------------------------------------------------------------------------------
/form/form_object_example/app/controllers/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/form_object_example/app/controllers/concerns/.keep
--------------------------------------------------------------------------------
/form/form_object_example/app/controllers/products_controller.rb:
--------------------------------------------------------------------------------
1 | class ProductsController < ApplicationController
2 | def index
3 | @product = Search::Product.new
4 | end
5 |
6 | def search
7 | @product = Search::Product.new(search_params)
8 | @products = @product
9 | .matches
10 | .order(availability: :desc, code: :asc)
11 | .decorate
12 | end
13 |
14 | private
15 |
16 | def search_params
17 | params
18 | .require(:search_product)
19 | .permit(Search::Product::ATTRIBUTES)
20 | end
21 | end
22 |
--------------------------------------------------------------------------------
/form/form_object_example/app/decorators/product_decorator.rb:
--------------------------------------------------------------------------------
1 | class ProductDecorator < Draper::Decorator
2 | delegate_all
3 |
4 | def sales_condition
5 | if availability
6 | h.content_tag :span, class: 'label label-success' do
7 | "販売中"
8 | end
9 | else
10 | h.content_tag :span, class: 'label label-default' do
11 | "販売不可"
12 | end
13 | end
14 | end
15 |
16 | def display_price
17 | h.number_to_currency price
18 | end
19 |
20 | def display_purchase_cost
21 | h.number_to_currency purchase_cost
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/form/form_object_example/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 | end
3 |
--------------------------------------------------------------------------------
/form/form_object_example/app/helpers/simple_search_form_helper.rb:
--------------------------------------------------------------------------------
1 | module SimpleSearchFormHelper
2 | end
3 |
--------------------------------------------------------------------------------
/form/form_object_example/app/helpers/tops_helper.rb:
--------------------------------------------------------------------------------
1 | module TopsHelper
2 | end
3 |
--------------------------------------------------------------------------------
/form/form_object_example/app/mailers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/form_object_example/app/mailers/.keep
--------------------------------------------------------------------------------
/form/form_object_example/app/models/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/form_object_example/app/models/.keep
--------------------------------------------------------------------------------
/form/form_object_example/app/models/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/form_object_example/app/models/concerns/.keep
--------------------------------------------------------------------------------
/form/form_object_example/app/models/search/base.rb:
--------------------------------------------------------------------------------
1 | class Search::Base
2 | include ActiveModel::Model
3 | include ActiveModel::Validations::Callbacks
4 |
5 | def contains(arel_attribute, value)
6 | arel_attribute.matches("%#{escape_like(value)}%")
7 | end
8 |
9 | def escape_like(string)
10 | string.gsub(/[\\%_]/) { |m| "\\#{m}" }
11 | end
12 |
13 | def value_to_boolean(value)
14 | ActiveRecord::ConnectionAdapters::Column.value_to_boolean(value)
15 | end
16 | end
17 |
--------------------------------------------------------------------------------
/form/form_object_example/app/views/products/index.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for(:title) do %>
2 | 商品検索
3 | <% end %>
4 |
5 | <%= form_for(@product, url: search_products_path, html: { method: :get, class: 'form-horizontal', role: 'form' }) do |f| %>
6 | <%= render 'search_form', f: f %>
7 | <% end %>
8 |
--------------------------------------------------------------------------------
/form/form_object_example/app/views/shared/_search_box.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
検索条件
4 |
5 |
6 | <%= yield %>
7 |
8 |
9 |
--------------------------------------------------------------------------------
/form/form_object_example/app/views/shared/_search_result_box.html.erb:
--------------------------------------------------------------------------------
1 | 検索結果
2 | <%= yield %>
3 |
--------------------------------------------------------------------------------
/form/form_object_example/app/views/shared/_topnav_link.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/form/form_object_example/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 | load Gem.bin_path('bundler', 'bundle')
4 |
--------------------------------------------------------------------------------
/form/form_object_example/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | APP_PATH = File.expand_path('../../config/application', __FILE__)
7 | require_relative '../config/boot'
8 | require 'rails/commands'
9 |
--------------------------------------------------------------------------------
/form/form_object_example/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | require_relative '../config/boot'
7 | require 'rake'
8 | Rake.application.run
9 |
--------------------------------------------------------------------------------
/form/form_object_example/config.ru:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require ::File.expand_path('../config/environment', __FILE__)
4 | run Rails.application
5 |
--------------------------------------------------------------------------------
/form/form_object_example/config/boot.rb:
--------------------------------------------------------------------------------
1 | # Set up gems listed in the Gemfile.
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 |
4 | require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5 |
--------------------------------------------------------------------------------
/form/form_object_example/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require File.expand_path('../application', __FILE__)
3 |
4 | # Initialize the Rails application.
5 | Rails.application.initialize!
6 |
--------------------------------------------------------------------------------
/form/form_object_example/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5 |
6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7 | # Rails.backtrace_cleaner.remove_silencers!
8 |
--------------------------------------------------------------------------------
/form/form_object_example/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.action_dispatch.cookies_serializer = :json
--------------------------------------------------------------------------------
/form/form_object_example/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Configure sensitive parameters which will be filtered from the log file.
4 | Rails.application.config.filter_parameters += [:password]
5 |
--------------------------------------------------------------------------------
/form/form_object_example/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new mime types for use in respond_to blocks:
4 | # Mime::Type.register "text/richtext", :rtf
5 |
--------------------------------------------------------------------------------
/form/form_object_example/config/initializers/session_store.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.session_store :cookie_store, key: '_form_example_session'
4 |
--------------------------------------------------------------------------------
/form/form_object_example/config/routes.rb:
--------------------------------------------------------------------------------
1 | Rails.application.routes.draw do
2 | root 'products#index'
3 |
4 | resources :products, only: [:index] do
5 | collection do
6 | get :search
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/form/form_object_example/lib/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/form_object_example/lib/assets/.keep
--------------------------------------------------------------------------------
/form/form_object_example/lib/tasks/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/form_object_example/lib/tasks/.keep
--------------------------------------------------------------------------------
/form/form_object_example/log/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/form_object_example/log/.keep
--------------------------------------------------------------------------------
/form/form_object_example/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/form_object_example/public/favicon.ico
--------------------------------------------------------------------------------
/form/form_object_example/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2 | #
3 | # To ban all spiders from the entire site uncomment the next two lines:
4 | # User-agent: *
5 | # Disallow: /
6 |
--------------------------------------------------------------------------------
/form/form_object_example/vendor/assets/javascripts/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/form_object_example/vendor/assets/javascripts/.keep
--------------------------------------------------------------------------------
/form/form_object_example/vendor/assets/stylesheets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/form_object_example/vendor/assets/stylesheets/.keep
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2 | #
3 | # If you find yourself ignoring temporary files generated by your text editor
4 | # or operating system, you probably want to add a global ignore instead:
5 | # git config --global core.excludesfile '~/.gitignore_global'
6 |
7 | # Ignore bundler config.
8 | /.bundle
9 |
10 | # Ignore the default SQLite database.
11 | /db/*.sqlite3
12 | /db/*.sqlite3-journal
13 |
14 | # Ignore all logfiles and tempfiles.
15 | /log/*.log
16 | /tmp
17 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/Rakefile:
--------------------------------------------------------------------------------
1 | # Add your own tasks in files placed in lib/tasks ending in .rake,
2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3 |
4 | require File.expand_path('../config/application', __FILE__)
5 |
6 | Rails.application.load_tasks
7 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/app/assets/images/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/many_to_many_checkbox_forms/app/assets/images/.keep
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/app/assets/javascripts/bootstrap.js.coffee:
--------------------------------------------------------------------------------
1 | jQuery ->
2 | $("a[rel~=popover], .has-popover").popover()
3 | $("a[rel~=tooltip], .has-tooltip").tooltip()
4 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/app/assets/javascripts/simple_search_form.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/app/assets/javascripts/tops.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/app/assets/stylesheets/simple_search_form.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the SimpleSearchForm controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/app/assets/stylesheets/tops.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the Tops controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | class ApplicationController < ActionController::Base
2 | # Prevent CSRF attacks by raising an exception.
3 | # For APIs, you may want to use :null_session instead.
4 | protect_from_forgery with: :exception
5 | end
6 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/app/controllers/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/many_to_many_checkbox_forms/app/controllers/concerns/.keep
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 | def navlink(title, path, current_controller, current_action)
3 | css_klass = ""
4 | if params[:controller] == current_controller.to_s && current_action.include?(params[:action].to_sym)
5 | css_klass = "active"
6 | end
7 | content_tag :li, class: css_klass do
8 | link_to title, path
9 | end
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/app/helpers/orders_helper.rb:
--------------------------------------------------------------------------------
1 | module OrdersHelper
2 | end
3 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/app/helpers/simple_search_form_helper.rb:
--------------------------------------------------------------------------------
1 | module SimpleSearchFormHelper
2 | end
3 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/app/helpers/tops_helper.rb:
--------------------------------------------------------------------------------
1 | module TopsHelper
2 | end
3 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/app/mailers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/many_to_many_checkbox_forms/app/mailers/.keep
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/app/models/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/many_to_many_checkbox_forms/app/models/.keep
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/app/models/category.rb:
--------------------------------------------------------------------------------
1 | # == Schema Information
2 | #
3 | # Table name: categories # カテゴリ
4 | #
5 | # id :integer not null, primary key
6 | # name :string(50) not null # カテゴリ名
7 | # created_at :datetime not null
8 | # updated_at :datetime not null
9 | #
10 |
11 | class Category < ActiveRecord::Base
12 | has_many :product_categories
13 | has_many :products, through: :product_categories
14 | end
15 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/app/models/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/many_to_many_checkbox_forms/app/models/concerns/.keep
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/app/models/product_category.rb:
--------------------------------------------------------------------------------
1 | # == Schema Information
2 | #
3 | # Table name: product_categories # 商品カテゴリ
4 | #
5 | # id :integer not null, primary key
6 | # product_id :integer not null # 商品ID
7 | # category_id :integer not null # カテゴリID
8 | # created_at :datetime not null
9 | # updated_at :datetime not null
10 | #
11 |
12 | class ProductCategory < ActiveRecord::Base
13 | belongs_to :product
14 | belongs_to :category
15 | end
16 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/app/models/validators/kana_validator.rb:
--------------------------------------------------------------------------------
1 | class KanaValidator < ActiveModel::EachValidator
2 | def validate_each(record, attribute, value)
3 | unless value =~ /\A([ァ-ヴーA-Za-z0-9\s]+)\z/
4 | record.errors[attribute] << (options[:message] || "はカタカナで入力してください")
5 | end
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/app/views/products/edit.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for(:title) do %>
2 | 商品更新
3 | <% end %>
4 |
5 | <%= render 'form', path: product_path(@product), method: :put %>
6 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/app/views/products/index.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for(:title) do %>
2 | 商品検索
3 | <% end %>
4 |
5 | <%= search_form_for(@q, url: search_products_path, html: { method: :get, class: 'form-horizontal', role: 'form' }) do |f| %>
6 | <%= render 'search_form', f: f %>
7 | <% end %>
8 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/app/views/products/new.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for(:title) do %>
2 | 商品登録
3 | <% end %>
4 |
5 | <%= render 'form', path: products_path, method: :post %>
6 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/app/views/shared/_search_box.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
検索条件
4 |
5 |
6 | <%= yield %>
7 |
8 |
9 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/app/views/shared/_search_result_box.html.erb:
--------------------------------------------------------------------------------
1 | 検索結果
2 | <%= yield %>
3 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/app/views/shared/_topnav_link.html.erb:
--------------------------------------------------------------------------------
1 | <%= navlink('商品検索', products_path, :products, [:index, :search]) %>
2 | <%= navlink('商品登録', new_product_path, :products, [:new, :create, :edit, :update]) %>
3 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 | load Gem.bin_path('bundler', 'bundle')
4 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | APP_PATH = File.expand_path('../../config/application', __FILE__)
7 | require_relative '../config/boot'
8 | require 'rails/commands'
9 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | require_relative '../config/boot'
7 | require 'rake'
8 | Rake.application.run
9 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/config.ru:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require ::File.expand_path('../config/environment', __FILE__)
4 | run Rails.application
5 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/config/boot.rb:
--------------------------------------------------------------------------------
1 | # Set up gems listed in the Gemfile.
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 |
4 | require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require File.expand_path('../application', __FILE__)
3 |
4 | # Initialize the Rails application.
5 | Rails.application.initialize!
6 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5 |
6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7 | # Rails.backtrace_cleaner.remove_silencers!
8 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.action_dispatch.cookies_serializer = :json
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Configure sensitive parameters which will be filtered from the log file.
4 | Rails.application.config.filter_parameters += [:password]
5 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new mime types for use in respond_to blocks:
4 | # Mime::Type.register "text/richtext", :rtf
5 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/config/initializers/session_store.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.session_store :cookie_store, key: '_form_example_session'
4 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/config/routes.rb:
--------------------------------------------------------------------------------
1 | Rails.application.routes.draw do
2 | root 'products#index'
3 |
4 | resources :products do
5 | collection do
6 | get :search
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/db/migrate/20141103073126_create_categories.rb:
--------------------------------------------------------------------------------
1 | class CreateCategories < ActiveRecord::Migration
2 | def change
3 | create_table :categories do |t|
4 | t.comment 'カテゴリ'
5 | t.string :name, limit: 50, null: false, comment: 'カテゴリ名'
6 |
7 | t.timestamps null: false
8 | end
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/db/migrate/20141103073210_create_product_categories.rb:
--------------------------------------------------------------------------------
1 | class CreateProductCategories < ActiveRecord::Migration
2 | def change
3 | create_table :product_categories do |t|
4 | t.comment '商品カテゴリ'
5 | t.integer :product_id, null: false, comment: '商品ID'
6 | t.integer :category_id, null: false, comment: 'カテゴリID'
7 |
8 | t.timestamps null: false
9 |
10 | t.foreign_key :products
11 | t.foreign_key :categories
12 | end
13 | end
14 | end
15 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/lib/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/many_to_many_checkbox_forms/lib/assets/.keep
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/lib/tasks/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/many_to_many_checkbox_forms/lib/tasks/.keep
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/log/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/many_to_many_checkbox_forms/log/.keep
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/many_to_many_checkbox_forms/public/favicon.ico
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2 | #
3 | # To ban all spiders from the entire site uncomment the next two lines:
4 | # User-agent: *
5 | # Disallow: /
6 |
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/vendor/assets/javascripts/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/many_to_many_checkbox_forms/vendor/assets/javascripts/.keep
--------------------------------------------------------------------------------
/form/many_to_many_checkbox_forms/vendor/assets/stylesheets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/many_to_many_checkbox_forms/vendor/assets/stylesheets/.keep
--------------------------------------------------------------------------------
/form/many_to_many_forms/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2 | #
3 | # If you find yourself ignoring temporary files generated by your text editor
4 | # or operating system, you probably want to add a global ignore instead:
5 | # git config --global core.excludesfile '~/.gitignore_global'
6 |
7 | # Ignore bundler config.
8 | /.bundle
9 |
10 | # Ignore the default SQLite database.
11 | /db/*.sqlite3
12 | /db/*.sqlite3-journal
13 |
14 | # Ignore all logfiles and tempfiles.
15 | /log/*.log
16 | /tmp
17 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/Rakefile:
--------------------------------------------------------------------------------
1 | # Add your own tasks in files placed in lib/tasks ending in .rake,
2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3 |
4 | require File.expand_path('../config/application', __FILE__)
5 |
6 | Rails.application.load_tasks
7 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/app/assets/images/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/many_to_many_forms/app/assets/images/.keep
--------------------------------------------------------------------------------
/form/many_to_many_forms/app/assets/javascripts/bootstrap.js.coffee:
--------------------------------------------------------------------------------
1 | jQuery ->
2 | $("a[rel~=popover], .has-popover").popover()
3 | $("a[rel~=tooltip], .has-tooltip").tooltip()
4 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/app/assets/javascripts/simple_search_form.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/app/assets/javascripts/tops.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/app/assets/stylesheets/simple_search_form.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the SimpleSearchForm controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/app/assets/stylesheets/tops.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the Tops controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | class ApplicationController < ActionController::Base
2 | # Prevent CSRF attacks by raising an exception.
3 | # For APIs, you may want to use :null_session instead.
4 | protect_from_forgery with: :exception
5 | end
6 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/app/controllers/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/many_to_many_forms/app/controllers/concerns/.keep
--------------------------------------------------------------------------------
/form/many_to_many_forms/app/decorators/product_decorator.rb:
--------------------------------------------------------------------------------
1 | class ProductDecorator < Draper::Decorator
2 | delegate_all
3 |
4 | def sales_condition
5 | if availability
6 | h.content_tag :span, class: 'label label-success' do
7 | "販売中"
8 | end
9 | else
10 | h.content_tag :span, class: 'label label-default' do
11 | "販売不可"
12 | end
13 | end
14 | end
15 |
16 | def display_price
17 | h.number_to_currency price
18 | end
19 |
20 | def display_purchase_cost
21 | h.number_to_currency purchase_cost
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 | def navlink(title, path, current_controller, current_action)
3 | css_klass = ""
4 | if params[:controller] == current_controller.to_s && current_action.include?(params[:action].to_sym)
5 | css_klass = "active"
6 | end
7 | content_tag :li, class: css_klass do
8 | link_to title, path
9 | end
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/app/helpers/orders_helper.rb:
--------------------------------------------------------------------------------
1 | module OrdersHelper
2 | end
3 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/app/helpers/simple_search_form_helper.rb:
--------------------------------------------------------------------------------
1 | module SimpleSearchFormHelper
2 | end
3 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/app/helpers/tops_helper.rb:
--------------------------------------------------------------------------------
1 | module TopsHelper
2 | end
3 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/app/mailers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/many_to_many_forms/app/mailers/.keep
--------------------------------------------------------------------------------
/form/many_to_many_forms/app/models/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/many_to_many_forms/app/models/.keep
--------------------------------------------------------------------------------
/form/many_to_many_forms/app/models/category.rb:
--------------------------------------------------------------------------------
1 | # == Schema Information
2 | #
3 | # Table name: categories # カテゴリ
4 | #
5 | # id :integer not null, primary key
6 | # name :string(50) not null # カテゴリ名
7 | # created_at :datetime not null
8 | # updated_at :datetime not null
9 | #
10 |
11 | class Category < ActiveRecord::Base
12 | has_many :product_categories
13 | has_many :products, through: :product_categories
14 | end
15 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/app/models/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/many_to_many_forms/app/models/concerns/.keep
--------------------------------------------------------------------------------
/form/many_to_many_forms/app/models/product_category.rb:
--------------------------------------------------------------------------------
1 | # == Schema Information
2 | #
3 | # Table name: product_categories # 商品カテゴリ
4 | #
5 | # id :integer not null, primary key
6 | # product_id :integer not null # 商品ID
7 | # category_id :integer not null # カテゴリID
8 | # created_at :datetime not null
9 | # updated_at :datetime not null
10 | #
11 |
12 | class ProductCategory < ActiveRecord::Base
13 | belongs_to :product
14 | belongs_to :category
15 | end
16 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/app/models/validators/kana_validator.rb:
--------------------------------------------------------------------------------
1 | class KanaValidator < ActiveModel::EachValidator
2 | def validate_each(record, attribute, value)
3 | unless value =~ /\A([ァ-ヴーA-Za-z0-9\s]+)\z/
4 | record.errors[attribute] << (options[:message] || "はカタカナで入力してください")
5 | end
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/app/views/products/_product_category_fields.html.erb:
--------------------------------------------------------------------------------
1 |
2 | <%= f.hidden_field :id %>
3 |
4 | <%= f.collection_select :category_id, f.object.selectable_categories, :id, :name, {}, class: 'form-control' %>
5 | |
6 |
7 | <%= link_to_remove_association '削除', f, class: 'btn btn-default' %>
8 | |
9 |
10 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/app/views/products/edit.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for(:title) do %>
2 | 商品更新
3 | <% end %>
4 |
5 | <%= render 'form', path: product_path(@product), method: :put %>
6 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/app/views/products/index.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for(:title) do %>
2 | 商品検索
3 | <% end %>
4 |
5 | <%= search_form_for(@q, url: search_products_path, html: { method: :get, class: 'form-horizontal', role: 'form' }) do |f| %>
6 | <%= render 'search_form', f: f %>
7 | <% end %>
8 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/app/views/products/new.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for(:title) do %>
2 | 商品登録
3 | <% end %>
4 |
5 | <%= render 'form', path: products_path, method: :post %>
6 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/app/views/shared/_search_box.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
検索条件
4 |
5 |
6 | <%= yield %>
7 |
8 |
9 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/app/views/shared/_search_result_box.html.erb:
--------------------------------------------------------------------------------
1 | 検索結果
2 | <%= yield %>
3 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/app/views/shared/_topnav_link.html.erb:
--------------------------------------------------------------------------------
1 | <%= navlink('商品検索', products_path, :products, [:index, :search]) %>
2 | <%= navlink('商品登録', new_product_path, :products, [:new, :create, :edit, :update]) %>
3 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 | load Gem.bin_path('bundler', 'bundle')
4 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | APP_PATH = File.expand_path('../../config/application', __FILE__)
7 | require_relative '../config/boot'
8 | require 'rails/commands'
9 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | require_relative '../config/boot'
7 | require 'rake'
8 | Rake.application.run
9 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/config.ru:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require ::File.expand_path('../config/environment', __FILE__)
4 | run Rails.application
5 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/config/boot.rb:
--------------------------------------------------------------------------------
1 | # Set up gems listed in the Gemfile.
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 |
4 | require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require File.expand_path('../application', __FILE__)
3 |
4 | # Initialize the Rails application.
5 | Rails.application.initialize!
6 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5 |
6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7 | # Rails.backtrace_cleaner.remove_silencers!
8 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.action_dispatch.cookies_serializer = :json
--------------------------------------------------------------------------------
/form/many_to_many_forms/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Configure sensitive parameters which will be filtered from the log file.
4 | Rails.application.config.filter_parameters += [:password]
5 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new mime types for use in respond_to blocks:
4 | # Mime::Type.register "text/richtext", :rtf
5 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/config/initializers/session_store.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.session_store :cookie_store, key: '_form_example_session'
4 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/config/routes.rb:
--------------------------------------------------------------------------------
1 | Rails.application.routes.draw do
2 | root 'products#index'
3 |
4 | resources :products do
5 | collection do
6 | get :search
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/db/migrate/20141103073126_create_categories.rb:
--------------------------------------------------------------------------------
1 | class CreateCategories < ActiveRecord::Migration
2 | def change
3 | create_table :categories do |t|
4 | t.comment 'カテゴリ'
5 | t.string :name, limit: 50, null: false, comment: 'カテゴリ名'
6 |
7 | t.timestamps null: false
8 | end
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/db/migrate/20141103073210_create_product_categories.rb:
--------------------------------------------------------------------------------
1 | class CreateProductCategories < ActiveRecord::Migration
2 | def change
3 | create_table :product_categories do |t|
4 | t.comment '商品カテゴリ'
5 | t.integer :product_id, null: false, comment: '商品ID'
6 | t.integer :category_id, null: false, comment: 'カテゴリID'
7 |
8 | t.timestamps null: false
9 |
10 | t.foreign_key :products
11 | t.foreign_key :categories
12 | end
13 | end
14 | end
15 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/lib/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/many_to_many_forms/lib/assets/.keep
--------------------------------------------------------------------------------
/form/many_to_many_forms/lib/tasks/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/many_to_many_forms/lib/tasks/.keep
--------------------------------------------------------------------------------
/form/many_to_many_forms/log/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/many_to_many_forms/log/.keep
--------------------------------------------------------------------------------
/form/many_to_many_forms/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/many_to_many_forms/public/favicon.ico
--------------------------------------------------------------------------------
/form/many_to_many_forms/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2 | #
3 | # To ban all spiders from the entire site uncomment the next two lines:
4 | # User-agent: *
5 | # Disallow: /
6 |
--------------------------------------------------------------------------------
/form/many_to_many_forms/vendor/assets/javascripts/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/many_to_many_forms/vendor/assets/javascripts/.keep
--------------------------------------------------------------------------------
/form/many_to_many_forms/vendor/assets/stylesheets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/many_to_many_forms/vendor/assets/stylesheets/.keep
--------------------------------------------------------------------------------
/form/ransack_search_example/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2 | #
3 | # If you find yourself ignoring temporary files generated by your text editor
4 | # or operating system, you probably want to add a global ignore instead:
5 | # git config --global core.excludesfile '~/.gitignore_global'
6 |
7 | # Ignore bundler config.
8 | /.bundle
9 |
10 | # Ignore the default SQLite database.
11 | /db/*.sqlite3
12 | /db/*.sqlite3-journal
13 |
14 | # Ignore all logfiles and tempfiles.
15 | /log/*.log
16 | /tmp
17 |
--------------------------------------------------------------------------------
/form/ransack_search_example/Rakefile:
--------------------------------------------------------------------------------
1 | # Add your own tasks in files placed in lib/tasks ending in .rake,
2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3 |
4 | require File.expand_path('../config/application', __FILE__)
5 |
6 | Rails.application.load_tasks
7 |
--------------------------------------------------------------------------------
/form/ransack_search_example/app/assets/images/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/ransack_search_example/app/assets/images/.keep
--------------------------------------------------------------------------------
/form/ransack_search_example/app/assets/javascripts/bootstrap.js.coffee:
--------------------------------------------------------------------------------
1 | jQuery ->
2 | $("a[rel~=popover], .has-popover").popover()
3 | $("a[rel~=tooltip], .has-tooltip").tooltip()
4 |
--------------------------------------------------------------------------------
/form/ransack_search_example/app/assets/javascripts/simple_search_form.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/form/ransack_search_example/app/assets/javascripts/tops.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/form/ransack_search_example/app/assets/stylesheets/simple_search_form.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the SimpleSearchForm controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/form/ransack_search_example/app/assets/stylesheets/tops.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the Tops controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/form/ransack_search_example/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | class ApplicationController < ActionController::Base
2 | # Prevent CSRF attacks by raising an exception.
3 | # For APIs, you may want to use :null_session instead.
4 | protect_from_forgery with: :exception
5 | end
6 |
--------------------------------------------------------------------------------
/form/ransack_search_example/app/controllers/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/ransack_search_example/app/controllers/concerns/.keep
--------------------------------------------------------------------------------
/form/ransack_search_example/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 | end
3 |
--------------------------------------------------------------------------------
/form/ransack_search_example/app/helpers/simple_search_form_helper.rb:
--------------------------------------------------------------------------------
1 | module SimpleSearchFormHelper
2 | end
3 |
--------------------------------------------------------------------------------
/form/ransack_search_example/app/helpers/tops_helper.rb:
--------------------------------------------------------------------------------
1 | module TopsHelper
2 | end
3 |
--------------------------------------------------------------------------------
/form/ransack_search_example/app/mailers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/ransack_search_example/app/mailers/.keep
--------------------------------------------------------------------------------
/form/ransack_search_example/app/models/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/ransack_search_example/app/models/.keep
--------------------------------------------------------------------------------
/form/ransack_search_example/app/models/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/ransack_search_example/app/models/concerns/.keep
--------------------------------------------------------------------------------
/form/ransack_search_example/app/views/products/index.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for(:title) do %>
2 | 商品検索
3 | <% end %>
4 |
5 | <%= search_form_for(@q, url: search_products_path, html: { method: :get, class: 'form-horizontal', role: 'form' }) do |f| %>
6 | <%= render 'search_form', f: f %>
7 | <% end %>
8 |
--------------------------------------------------------------------------------
/form/ransack_search_example/app/views/shared/_search_box.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
検索条件
4 |
5 |
6 | <%= yield %>
7 |
8 |
9 |
--------------------------------------------------------------------------------
/form/ransack_search_example/app/views/shared/_search_result_box.html.erb:
--------------------------------------------------------------------------------
1 | 検索結果
2 | <%= yield %>
3 |
--------------------------------------------------------------------------------
/form/ransack_search_example/app/views/shared/_topnav_link.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/form/ransack_search_example/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 | load Gem.bin_path('bundler', 'bundle')
4 |
--------------------------------------------------------------------------------
/form/ransack_search_example/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | APP_PATH = File.expand_path('../../config/application', __FILE__)
7 | require_relative '../config/boot'
8 | require 'rails/commands'
9 |
--------------------------------------------------------------------------------
/form/ransack_search_example/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | require_relative '../config/boot'
7 | require 'rake'
8 | Rake.application.run
9 |
--------------------------------------------------------------------------------
/form/ransack_search_example/config.ru:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require ::File.expand_path('../config/environment', __FILE__)
4 | run Rails.application
5 |
--------------------------------------------------------------------------------
/form/ransack_search_example/config/boot.rb:
--------------------------------------------------------------------------------
1 | # Set up gems listed in the Gemfile.
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 |
4 | require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5 |
--------------------------------------------------------------------------------
/form/ransack_search_example/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require File.expand_path('../application', __FILE__)
3 |
4 | # Initialize the Rails application.
5 | Rails.application.initialize!
6 |
--------------------------------------------------------------------------------
/form/ransack_search_example/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5 |
6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7 | # Rails.backtrace_cleaner.remove_silencers!
8 |
--------------------------------------------------------------------------------
/form/ransack_search_example/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.action_dispatch.cookies_serializer = :json
--------------------------------------------------------------------------------
/form/ransack_search_example/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Configure sensitive parameters which will be filtered from the log file.
4 | Rails.application.config.filter_parameters += [:password]
5 |
--------------------------------------------------------------------------------
/form/ransack_search_example/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new mime types for use in respond_to blocks:
4 | # Mime::Type.register "text/richtext", :rtf
5 |
--------------------------------------------------------------------------------
/form/ransack_search_example/config/initializers/session_store.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.session_store :cookie_store, key: '_form_example_session'
4 |
--------------------------------------------------------------------------------
/form/ransack_search_example/config/routes.rb:
--------------------------------------------------------------------------------
1 | Rails.application.routes.draw do
2 | root 'products#index'
3 |
4 | resources :products, only: [:index] do
5 | collection do
6 | get :search
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/form/ransack_search_example/lib/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/ransack_search_example/lib/assets/.keep
--------------------------------------------------------------------------------
/form/ransack_search_example/lib/tasks/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/ransack_search_example/lib/tasks/.keep
--------------------------------------------------------------------------------
/form/ransack_search_example/log/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/ransack_search_example/log/.keep
--------------------------------------------------------------------------------
/form/ransack_search_example/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/ransack_search_example/public/favicon.ico
--------------------------------------------------------------------------------
/form/ransack_search_example/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2 | #
3 | # To ban all spiders from the entire site uncomment the next two lines:
4 | # User-agent: *
5 | # Disallow: /
6 |
--------------------------------------------------------------------------------
/form/ransack_search_example/vendor/assets/javascripts/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/ransack_search_example/vendor/assets/javascripts/.keep
--------------------------------------------------------------------------------
/form/ransack_search_example/vendor/assets/stylesheets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/form/ransack_search_example/vendor/assets/stylesheets/.keep
--------------------------------------------------------------------------------
/guide_template/assets/javascripts/bootstrap.js.coffee:
--------------------------------------------------------------------------------
1 | jQuery ->
2 | $("a[rel~=popover], .has-popover").popover()
3 | $("a[rel~=tooltip], .has-tooltip").tooltip()
4 |
--------------------------------------------------------------------------------
/guide_template/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 | def navlink(title, path, current_controller, current_action)
3 | css_klass = ""
4 | if params[:controller] == current_controller.to_s && current_action.include?(params[:action].to_sym)
5 | css_klass = "active"
6 | end
7 | content_tag :li, class: css_klass do
8 | link_to title, path
9 | end
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/guide_template/views/shared/_search_box.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
検索条件
4 |
5 |
6 | <%= yield %>
7 |
8 |
9 |
--------------------------------------------------------------------------------
/guide_template/views/shared/_search_result_box.html.erb:
--------------------------------------------------------------------------------
1 | 検索結果
2 | <%= yield %>
3 |
--------------------------------------------------------------------------------
/guide_template/views/shared/_topnav_link.html.erb:
--------------------------------------------------------------------------------
1 | <%= navlink('Add Something...', root_path, :products, [:index]) %>
2 |
--------------------------------------------------------------------------------
/report/csv_export/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2 | #
3 | # If you find yourself ignoring temporary files generated by your text editor
4 | # or operating system, you probably want to add a global ignore instead:
5 | # git config --global core.excludesfile '~/.gitignore_global'
6 |
7 | # Ignore bundler config.
8 | /.bundle
9 |
10 | # Ignore the default SQLite database.
11 | /db/*.sqlite3
12 | /db/*.sqlite3-journal
13 |
14 | # Ignore all logfiles and tempfiles.
15 | /log/*.log
16 | /tmp
17 |
--------------------------------------------------------------------------------
/report/csv_export/Rakefile:
--------------------------------------------------------------------------------
1 | # Add your own tasks in files placed in lib/tasks ending in .rake,
2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3 |
4 | require File.expand_path('../config/application', __FILE__)
5 |
6 | Rails.application.load_tasks
7 |
--------------------------------------------------------------------------------
/report/csv_export/app/assets/images/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/csv_export/app/assets/images/.keep
--------------------------------------------------------------------------------
/report/csv_export/app/assets/javascripts/bootstrap.js.coffee:
--------------------------------------------------------------------------------
1 | jQuery ->
2 | $("a[rel~=popover], .has-popover").popover()
3 | $("a[rel~=tooltip], .has-tooltip").tooltip()
4 |
--------------------------------------------------------------------------------
/report/csv_export/app/assets/javascripts/simple_search_form.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/report/csv_export/app/assets/javascripts/tops.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/report/csv_export/app/assets/stylesheets/simple_search_form.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the SimpleSearchForm controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/report/csv_export/app/assets/stylesheets/tops.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the Tops controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/report/csv_export/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | class ApplicationController < ActionController::Base
2 | # Prevent CSRF attacks by raising an exception.
3 | # For APIs, you may want to use :null_session instead.
4 | protect_from_forgery with: :exception
5 | end
6 |
--------------------------------------------------------------------------------
/report/csv_export/app/controllers/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/csv_export/app/controllers/concerns/.keep
--------------------------------------------------------------------------------
/report/csv_export/app/controllers/products_controller.rb:
--------------------------------------------------------------------------------
1 | class ProductsController < ApplicationController
2 | def index
3 | end
4 |
5 | def export_csv
6 | @products = Product.all
7 | send_data @products.to_csv, filename: "#{Time.current.strftime('%Y%m%d')}.csv"
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/report/csv_export/app/decorators/product_decorator.rb:
--------------------------------------------------------------------------------
1 | class ProductDecorator < Draper::Decorator
2 | delegate_all
3 |
4 | def sales_condition
5 | if availability
6 | h.content_tag :span, class: 'label label-success' do
7 | "販売中"
8 | end
9 | else
10 | h.content_tag :span, class: 'label label-default' do
11 | "販売不可"
12 | end
13 | end
14 | end
15 |
16 | def display_price
17 | h.number_to_currency price
18 | end
19 |
20 | def display_purchase_cost
21 | h.number_to_currency purchase_cost
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/report/csv_export/app/decorators/products_decorator.rb:
--------------------------------------------------------------------------------
1 | class ProductsDecorator < Draper::CollectionDecorator
2 | delegate :to_csv
3 | end
4 |
--------------------------------------------------------------------------------
/report/csv_export/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 | end
3 |
--------------------------------------------------------------------------------
/report/csv_export/app/helpers/simple_search_form_helper.rb:
--------------------------------------------------------------------------------
1 | module SimpleSearchFormHelper
2 | end
3 |
--------------------------------------------------------------------------------
/report/csv_export/app/helpers/tops_helper.rb:
--------------------------------------------------------------------------------
1 | module TopsHelper
2 | end
3 |
--------------------------------------------------------------------------------
/report/csv_export/app/mailers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/csv_export/app/mailers/.keep
--------------------------------------------------------------------------------
/report/csv_export/app/models/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/csv_export/app/models/.keep
--------------------------------------------------------------------------------
/report/csv_export/app/models/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/csv_export/app/models/concerns/.keep
--------------------------------------------------------------------------------
/report/csv_export/app/models/concerns/csv_exportable.rb:
--------------------------------------------------------------------------------
1 | require 'csv'
2 |
3 | module CsvExportable
4 | extend ActiveSupport::Concern
5 |
6 | module ClassMethods
7 | def to_csv(header: column_names, columns: column_names, row_sep: "\r\n", encoding: Encoding::CP932)
8 | records = CSV.generate(row_sep: row_sep) do |csv|
9 | csv << header
10 | all.each { |record| csv << record.attributes.values_at(*columns) }
11 | end
12 | records.encode(encoding, invalid: :replace, undef: :replace)
13 | end
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/report/csv_export/app/views/products/index.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for(:title) do %>
2 | 商品CSV出力
3 | <% end %>
4 |
5 | <%= link_to 'CSV出力', export_csv_products_path, class: 'btn btn-default' %>
6 |
--------------------------------------------------------------------------------
/report/csv_export/app/views/shared/_search_box.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
検索条件
4 |
5 |
6 | <%= yield %>
7 |
8 |
9 |
--------------------------------------------------------------------------------
/report/csv_export/app/views/shared/_search_result_box.html.erb:
--------------------------------------------------------------------------------
1 | 検索結果
2 | <%= yield %>
3 |
--------------------------------------------------------------------------------
/report/csv_export/app/views/shared/_topnav_link.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/report/csv_export/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 | load Gem.bin_path('bundler', 'bundle')
4 |
--------------------------------------------------------------------------------
/report/csv_export/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | APP_PATH = File.expand_path('../../config/application', __FILE__)
7 | require_relative '../config/boot'
8 | require 'rails/commands'
9 |
--------------------------------------------------------------------------------
/report/csv_export/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | require_relative '../config/boot'
7 | require 'rake'
8 | Rake.application.run
9 |
--------------------------------------------------------------------------------
/report/csv_export/config.ru:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require ::File.expand_path('../config/environment', __FILE__)
4 | run Rails.application
5 |
--------------------------------------------------------------------------------
/report/csv_export/config/boot.rb:
--------------------------------------------------------------------------------
1 | # Set up gems listed in the Gemfile.
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 |
4 | require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5 |
--------------------------------------------------------------------------------
/report/csv_export/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require File.expand_path('../application', __FILE__)
3 |
4 | # Initialize the Rails application.
5 | Rails.application.initialize!
6 |
--------------------------------------------------------------------------------
/report/csv_export/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5 |
6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7 | # Rails.backtrace_cleaner.remove_silencers!
8 |
--------------------------------------------------------------------------------
/report/csv_export/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.action_dispatch.cookies_serializer = :json
--------------------------------------------------------------------------------
/report/csv_export/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Configure sensitive parameters which will be filtered from the log file.
4 | Rails.application.config.filter_parameters += [:password]
5 |
--------------------------------------------------------------------------------
/report/csv_export/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new mime types for use in respond_to blocks:
4 | # Mime::Type.register "text/richtext", :rtf
5 |
--------------------------------------------------------------------------------
/report/csv_export/config/initializers/session_store.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.session_store :cookie_store, key: '_form_example_session'
4 |
--------------------------------------------------------------------------------
/report/csv_export/config/routes.rb:
--------------------------------------------------------------------------------
1 | Rails.application.routes.draw do
2 | root 'products#index'
3 |
4 | resources :products, only: [:index] do
5 | collection do
6 | get :export_csv
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/report/csv_export/lib/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/csv_export/lib/assets/.keep
--------------------------------------------------------------------------------
/report/csv_export/lib/tasks/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/csv_export/lib/tasks/.keep
--------------------------------------------------------------------------------
/report/csv_export/log/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/csv_export/log/.keep
--------------------------------------------------------------------------------
/report/csv_export/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/csv_export/public/favicon.ico
--------------------------------------------------------------------------------
/report/csv_export/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2 | #
3 | # To ban all spiders from the entire site uncomment the next two lines:
4 | # User-agent: *
5 | # Disallow: /
6 |
--------------------------------------------------------------------------------
/report/csv_export/vendor/assets/javascripts/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/csv_export/vendor/assets/javascripts/.keep
--------------------------------------------------------------------------------
/report/csv_export/vendor/assets/stylesheets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/csv_export/vendor/assets/stylesheets/.keep
--------------------------------------------------------------------------------
/report/search_csv_export/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2 | #
3 | # If you find yourself ignoring temporary files generated by your text editor
4 | # or operating system, you probably want to add a global ignore instead:
5 | # git config --global core.excludesfile '~/.gitignore_global'
6 |
7 | # Ignore bundler config.
8 | /.bundle
9 |
10 | # Ignore the default SQLite database.
11 | /db/*.sqlite3
12 | /db/*.sqlite3-journal
13 |
14 | # Ignore all logfiles and tempfiles.
15 | /log/*.log
16 | /tmp
17 |
--------------------------------------------------------------------------------
/report/search_csv_export/Rakefile:
--------------------------------------------------------------------------------
1 | # Add your own tasks in files placed in lib/tasks ending in .rake,
2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3 |
4 | require File.expand_path('../config/application', __FILE__)
5 |
6 | Rails.application.load_tasks
7 |
--------------------------------------------------------------------------------
/report/search_csv_export/app/assets/images/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/search_csv_export/app/assets/images/.keep
--------------------------------------------------------------------------------
/report/search_csv_export/app/assets/javascripts/bootstrap.js.coffee:
--------------------------------------------------------------------------------
1 | jQuery ->
2 | $("a[rel~=popover], .has-popover").popover()
3 | $("a[rel~=tooltip], .has-tooltip").tooltip()
4 |
--------------------------------------------------------------------------------
/report/search_csv_export/app/assets/javascripts/simple_search_form.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/report/search_csv_export/app/assets/javascripts/tops.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/report/search_csv_export/app/assets/stylesheets/simple_search_form.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the SimpleSearchForm controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/report/search_csv_export/app/assets/stylesheets/tops.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the Tops controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/report/search_csv_export/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | class ApplicationController < ActionController::Base
2 | # Prevent CSRF attacks by raising an exception.
3 | # For APIs, you may want to use :null_session instead.
4 | protect_from_forgery with: :exception
5 | end
6 |
--------------------------------------------------------------------------------
/report/search_csv_export/app/controllers/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/search_csv_export/app/controllers/concerns/.keep
--------------------------------------------------------------------------------
/report/search_csv_export/app/decorators/product_decorator.rb:
--------------------------------------------------------------------------------
1 | class ProductDecorator < Draper::Decorator
2 | delegate_all
3 |
4 | def sales_condition
5 | if availability
6 | h.content_tag :span, class: 'label label-success' do
7 | "販売中"
8 | end
9 | else
10 | h.content_tag :span, class: 'label label-default' do
11 | "販売不可"
12 | end
13 | end
14 | end
15 |
16 | def display_price
17 | h.number_to_currency price
18 | end
19 |
20 | def display_purchase_cost
21 | h.number_to_currency purchase_cost
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/report/search_csv_export/app/decorators/products_decorator.rb:
--------------------------------------------------------------------------------
1 | class ProductsDecorator < Draper::CollectionDecorator
2 | delegate :to_csv
3 | end
4 |
--------------------------------------------------------------------------------
/report/search_csv_export/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 | end
3 |
--------------------------------------------------------------------------------
/report/search_csv_export/app/helpers/simple_search_form_helper.rb:
--------------------------------------------------------------------------------
1 | module SimpleSearchFormHelper
2 | end
3 |
--------------------------------------------------------------------------------
/report/search_csv_export/app/helpers/tops_helper.rb:
--------------------------------------------------------------------------------
1 | module TopsHelper
2 | end
3 |
--------------------------------------------------------------------------------
/report/search_csv_export/app/mailers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/search_csv_export/app/mailers/.keep
--------------------------------------------------------------------------------
/report/search_csv_export/app/models/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/search_csv_export/app/models/.keep
--------------------------------------------------------------------------------
/report/search_csv_export/app/models/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/search_csv_export/app/models/concerns/.keep
--------------------------------------------------------------------------------
/report/search_csv_export/app/models/concerns/csv_exportable.rb:
--------------------------------------------------------------------------------
1 | require 'csv'
2 |
3 | module CsvExportable
4 | extend ActiveSupport::Concern
5 |
6 | module ClassMethods
7 | def to_csv(header: column_names, columns: column_names, row_sep: "\r\n", encoding: Encoding::CP932)
8 | records = CSV.generate(row_sep: row_sep) do |csv|
9 | csv << header
10 | all.each { |record| csv << record.attributes.values_at(*columns) }
11 | end
12 | records.encode(encoding, invalid: :replace, undef: :replace)
13 | end
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/report/search_csv_export/app/views/products/index.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for(:title) do %>
2 | 商品検索
3 | <% end %>
4 |
5 | <%= search_form_for(@q, url: search_products_path, html: { method: :get, class: 'form-horizontal', role: 'form' }) do |f| %>
6 | <%= render 'search_form', f: f %>
7 | <% end %>
8 |
--------------------------------------------------------------------------------
/report/search_csv_export/app/views/shared/_search_box.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
検索条件
4 |
5 |
6 | <%= yield %>
7 |
8 |
9 |
--------------------------------------------------------------------------------
/report/search_csv_export/app/views/shared/_search_result_box.html.erb:
--------------------------------------------------------------------------------
1 | 検索結果
2 | <%= yield %>
3 |
--------------------------------------------------------------------------------
/report/search_csv_export/app/views/shared/_topnav_link.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/report/search_csv_export/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 | load Gem.bin_path('bundler', 'bundle')
4 |
--------------------------------------------------------------------------------
/report/search_csv_export/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | APP_PATH = File.expand_path('../../config/application', __FILE__)
7 | require_relative '../config/boot'
8 | require 'rails/commands'
9 |
--------------------------------------------------------------------------------
/report/search_csv_export/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | require_relative '../config/boot'
7 | require 'rake'
8 | Rake.application.run
9 |
--------------------------------------------------------------------------------
/report/search_csv_export/config.ru:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require ::File.expand_path('../config/environment', __FILE__)
4 | run Rails.application
5 |
--------------------------------------------------------------------------------
/report/search_csv_export/config/boot.rb:
--------------------------------------------------------------------------------
1 | # Set up gems listed in the Gemfile.
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 |
4 | require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5 |
--------------------------------------------------------------------------------
/report/search_csv_export/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require File.expand_path('../application', __FILE__)
3 |
4 | # Initialize the Rails application.
5 | Rails.application.initialize!
6 |
--------------------------------------------------------------------------------
/report/search_csv_export/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5 |
6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7 | # Rails.backtrace_cleaner.remove_silencers!
8 |
--------------------------------------------------------------------------------
/report/search_csv_export/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.action_dispatch.cookies_serializer = :json
--------------------------------------------------------------------------------
/report/search_csv_export/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Configure sensitive parameters which will be filtered from the log file.
4 | Rails.application.config.filter_parameters += [:password]
5 |
--------------------------------------------------------------------------------
/report/search_csv_export/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new mime types for use in respond_to blocks:
4 | # Mime::Type.register "text/richtext", :rtf
5 |
--------------------------------------------------------------------------------
/report/search_csv_export/config/initializers/session_store.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.session_store :cookie_store, key: '_form_example_session'
4 |
--------------------------------------------------------------------------------
/report/search_csv_export/config/routes.rb:
--------------------------------------------------------------------------------
1 | Rails.application.routes.draw do
2 | root 'products#index'
3 |
4 | resources :products, only: [:index] do
5 | collection do
6 | get :search
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/report/search_csv_export/lib/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/search_csv_export/lib/assets/.keep
--------------------------------------------------------------------------------
/report/search_csv_export/lib/tasks/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/search_csv_export/lib/tasks/.keep
--------------------------------------------------------------------------------
/report/search_csv_export/log/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/search_csv_export/log/.keep
--------------------------------------------------------------------------------
/report/search_csv_export/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/search_csv_export/public/favicon.ico
--------------------------------------------------------------------------------
/report/search_csv_export/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2 | #
3 | # To ban all spiders from the entire site uncomment the next two lines:
4 | # User-agent: *
5 | # Disallow: /
6 |
--------------------------------------------------------------------------------
/report/search_csv_export/vendor/assets/javascripts/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/search_csv_export/vendor/assets/javascripts/.keep
--------------------------------------------------------------------------------
/report/search_csv_export/vendor/assets/stylesheets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/search_csv_export/vendor/assets/stylesheets/.keep
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2 | #
3 | # If you find yourself ignoring temporary files generated by your text editor
4 | # or operating system, you probably want to add a global ignore instead:
5 | # git config --global core.excludesfile '~/.gitignore_global'
6 |
7 | # Ignore bundler config.
8 | /.bundle
9 |
10 | # Ignore the default SQLite database.
11 | /db/*.sqlite3
12 | /db/*.sqlite3-journal
13 |
14 | # Ignore all logfiles and tempfiles.
15 | /log/*.log
16 | /tmp
17 |
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/Rakefile:
--------------------------------------------------------------------------------
1 | # Add your own tasks in files placed in lib/tasks ending in .rake,
2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3 |
4 | require File.expand_path('../config/application', __FILE__)
5 |
6 | Rails.application.load_tasks
7 |
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/app/assets/images/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/search_csv_export_change_route_example/app/assets/images/.keep
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/app/assets/javascripts/bootstrap.js.coffee:
--------------------------------------------------------------------------------
1 | jQuery ->
2 | $("a[rel~=popover], .has-popover").popover()
3 | $("a[rel~=tooltip], .has-tooltip").tooltip()
4 |
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/app/assets/javascripts/simple_search_form.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/app/assets/javascripts/tops.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/app/assets/stylesheets/simple_search_form.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the SimpleSearchForm controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/app/assets/stylesheets/tops.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the Tops controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | class ApplicationController < ActionController::Base
2 | # Prevent CSRF attacks by raising an exception.
3 | # For APIs, you may want to use :null_session instead.
4 | protect_from_forgery with: :exception
5 | end
6 |
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/app/controllers/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/search_csv_export_change_route_example/app/controllers/concerns/.keep
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/app/decorators/products_decorator.rb:
--------------------------------------------------------------------------------
1 | class ProductsDecorator < Draper::CollectionDecorator
2 | delegate :to_csv
3 | end
4 |
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 | end
3 |
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/app/helpers/simple_search_form_helper.rb:
--------------------------------------------------------------------------------
1 | module SimpleSearchFormHelper
2 | end
3 |
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/app/helpers/tops_helper.rb:
--------------------------------------------------------------------------------
1 | module TopsHelper
2 | end
3 |
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/app/mailers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/search_csv_export_change_route_example/app/mailers/.keep
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/app/models/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/search_csv_export_change_route_example/app/models/.keep
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/app/models/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/search_csv_export_change_route_example/app/models/concerns/.keep
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/app/models/concerns/csv_exportable.rb:
--------------------------------------------------------------------------------
1 | require 'csv'
2 |
3 | module CsvExportable
4 | extend ActiveSupport::Concern
5 |
6 | module ClassMethods
7 | def to_csv(header: column_names, columns: column_names, row_sep: "\r\n", encoding: Encoding::CP932)
8 | records = CSV.generate(row_sep: row_sep) do |csv|
9 | csv << header
10 | all.each { |record| csv << record.attributes.values_at(*columns) }
11 | end
12 | records.encode(encoding, invalid: :replace, undef: :replace)
13 | end
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/app/views/products/index.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for(:title) do %>
2 | 商品検索
3 | <% end %>
4 |
5 | <%= search_form_for(@q, url: search_products_path, html: { method: :get, class: 'form-horizontal', role: 'form' }) do |f| %>
6 | <%= render 'search_form', f: f %>
7 | <% end %>
8 |
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/app/views/shared/_search_box.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
検索条件
4 |
5 |
6 | <%= yield %>
7 |
8 |
9 |
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/app/views/shared/_search_result_box.html.erb:
--------------------------------------------------------------------------------
1 | 検索結果
2 | <%= yield %>
3 |
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/app/views/shared/_topnav_link.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 | load Gem.bin_path('bundler', 'bundle')
4 |
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | APP_PATH = File.expand_path('../../config/application', __FILE__)
7 | require_relative '../config/boot'
8 | require 'rails/commands'
9 |
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | require_relative '../config/boot'
7 | require 'rake'
8 | Rake.application.run
9 |
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/config.ru:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require ::File.expand_path('../config/environment', __FILE__)
4 | run Rails.application
5 |
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/config/boot.rb:
--------------------------------------------------------------------------------
1 | # Set up gems listed in the Gemfile.
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 |
4 | require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5 |
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require File.expand_path('../application', __FILE__)
3 |
4 | # Initialize the Rails application.
5 | Rails.application.initialize!
6 |
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5 |
6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7 | # Rails.backtrace_cleaner.remove_silencers!
8 |
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.action_dispatch.cookies_serializer = :json
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Configure sensitive parameters which will be filtered from the log file.
4 | Rails.application.config.filter_parameters += [:password]
5 |
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new mime types for use in respond_to blocks:
4 | # Mime::Type.register "text/richtext", :rtf
5 |
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/config/initializers/session_store.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.session_store :cookie_store, key: '_form_example_session'
4 |
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/config/routes.rb:
--------------------------------------------------------------------------------
1 | class CsvExportConstraint
2 | def self.matches?(request)
3 | request.params.has_key?(:export_csv)
4 | end
5 | end
6 |
7 | Rails.application.routes.draw do
8 | root 'products#index'
9 |
10 | resources :products, only: [:index] do
11 | collection do
12 | get :search, action: :export_csv, constraints: CsvExportConstraint
13 | get :search
14 | end
15 | end
16 | end
17 |
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/lib/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/search_csv_export_change_route_example/lib/assets/.keep
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/lib/tasks/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/search_csv_export_change_route_example/lib/tasks/.keep
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/log/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/search_csv_export_change_route_example/log/.keep
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/search_csv_export_change_route_example/public/favicon.ico
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2 | #
3 | # To ban all spiders from the entire site uncomment the next two lines:
4 | # User-agent: *
5 | # Disallow: /
6 |
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/vendor/assets/javascripts/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/search_csv_export_change_route_example/vendor/assets/javascripts/.keep
--------------------------------------------------------------------------------
/report/search_csv_export_change_route_example/vendor/assets/stylesheets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/report/search_csv_export_change_route_example/vendor/assets/stylesheets/.keep
--------------------------------------------------------------------------------
/upload/carrierwave_file/Rakefile:
--------------------------------------------------------------------------------
1 | # Add your own tasks in files placed in lib/tasks ending in .rake,
2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3 |
4 | require File.expand_path('../config/application', __FILE__)
5 |
6 | Rails.application.load_tasks
7 |
--------------------------------------------------------------------------------
/upload/carrierwave_file/app/assets/images/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/upload/carrierwave_file/app/assets/images/.keep
--------------------------------------------------------------------------------
/upload/carrierwave_file/app/assets/javascripts/bootstrap.js.coffee:
--------------------------------------------------------------------------------
1 | jQuery ->
2 | $("a[rel~=popover], .has-popover").popover()
3 | $("a[rel~=tooltip], .has-tooltip").tooltip()
4 |
--------------------------------------------------------------------------------
/upload/carrierwave_file/app/assets/javascripts/products.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/upload/carrierwave_file/app/assets/stylesheets/products.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the products controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/upload/carrierwave_file/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | class ApplicationController < ActionController::Base
2 | # Prevent CSRF attacks by raising an exception.
3 | # For APIs, you may want to use :null_session instead.
4 | protect_from_forgery with: :exception
5 | end
6 |
--------------------------------------------------------------------------------
/upload/carrierwave_file/app/controllers/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/upload/carrierwave_file/app/controllers/concerns/.keep
--------------------------------------------------------------------------------
/upload/carrierwave_file/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 | def navlink(title, path, current_controller, current_action)
3 | css_klass = ""
4 | if params[:controller] == current_controller.to_s && current_action.include?(params[:action].to_sym)
5 | css_klass = "active"
6 | end
7 | content_tag :li, class: css_klass do
8 | link_to title, path
9 | end
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/upload/carrierwave_file/app/mailers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/upload/carrierwave_file/app/mailers/.keep
--------------------------------------------------------------------------------
/upload/carrierwave_file/app/models/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/upload/carrierwave_file/app/models/.keep
--------------------------------------------------------------------------------
/upload/carrierwave_file/app/models/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/upload/carrierwave_file/app/models/concerns/.keep
--------------------------------------------------------------------------------
/upload/carrierwave_file/app/models/product.rb:
--------------------------------------------------------------------------------
1 | # == Schema Information
2 | #
3 | # Table name: products
4 | #
5 | # id :integer not null, primary key
6 | # name :string(255) not null
7 | # image :string(255)
8 | # created_at :datetime not null
9 | # updated_at :datetime not null
10 | #
11 |
12 | class Product < ActiveRecord::Base
13 | mount_uploader :image, ImageUploader
14 |
15 | # Validations
16 | validates :name, presence: true, length: { maximum: 255 }
17 | validates :image, presence: true
18 | end
19 |
--------------------------------------------------------------------------------
/upload/carrierwave_file/app/views/products/edit.html.erb:
--------------------------------------------------------------------------------
1 | Editing product
2 |
3 | <%= render 'form' %>
4 |
5 | <%= link_to 'Show', @product %> |
6 | <%= link_to 'Back', products_path %>
7 |
--------------------------------------------------------------------------------
/upload/carrierwave_file/app/views/products/new.html.erb:
--------------------------------------------------------------------------------
1 | New Product
2 |
3 | <%= render 'form' %>
4 |
5 | <%= link_to 'Back', products_path %>
6 |
--------------------------------------------------------------------------------
/upload/carrierwave_file/app/views/products/show.html.erb:
--------------------------------------------------------------------------------
1 | <%= notice %>
2 |
3 |
4 | Name:
5 | <%= @product.name %>
6 |
7 |
8 | Image:
9 | <% if @product.image.present? %>
10 | <%= image_tag @product.image_url %>
11 | <% end %>
12 |
13 |
14 | <%= link_to 'Edit', edit_product_path(@product) %> |
15 | <%= link_to 'Back', products_path %>
16 |
--------------------------------------------------------------------------------
/upload/carrierwave_file/app/views/shared/_search_box.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
検索条件
4 |
5 |
6 | <%= yield %>
7 |
8 |
9 |
--------------------------------------------------------------------------------
/upload/carrierwave_file/app/views/shared/_search_result_box.html.erb:
--------------------------------------------------------------------------------
1 | 検索結果
2 | <%= yield %>
3 |
--------------------------------------------------------------------------------
/upload/carrierwave_file/app/views/shared/_topnav_link.html.erb:
--------------------------------------------------------------------------------
1 | <%= navlink('商品一覧', root_path, :products, [:index]) %>
2 |
--------------------------------------------------------------------------------
/upload/carrierwave_file/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 | load Gem.bin_path('bundler', 'bundle')
4 |
--------------------------------------------------------------------------------
/upload/carrierwave_file/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | APP_PATH = File.expand_path('../../config/application', __FILE__)
7 | require_relative '../config/boot'
8 | require 'rails/commands'
9 |
--------------------------------------------------------------------------------
/upload/carrierwave_file/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | require_relative '../config/boot'
7 | require 'rake'
8 | Rake.application.run
9 |
--------------------------------------------------------------------------------
/upload/carrierwave_file/bin/spring:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | # This file loads spring without using Bundler, in order to be fast.
4 | # It gets overwritten when you run the `spring binstub` command.
5 |
6 | unless defined?(Spring)
7 | require "rubygems"
8 | require "bundler"
9 |
10 | if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)
11 | Gem.paths = { "GEM_PATH" => [Bundler.bundle_path.to_s, *Gem.path].uniq }
12 | gem "spring", match[1]
13 | require "spring/binstub"
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/upload/carrierwave_file/config.ru:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require ::File.expand_path('../config/environment', __FILE__)
4 | run Rails.application
5 |
--------------------------------------------------------------------------------
/upload/carrierwave_file/config/boot.rb:
--------------------------------------------------------------------------------
1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
2 |
3 | require 'bundler/setup' # Set up gems listed in the Gemfile.
4 |
--------------------------------------------------------------------------------
/upload/carrierwave_file/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require File.expand_path('../application', __FILE__)
3 |
4 | # Initialize the Rails application.
5 | Rails.application.initialize!
6 |
--------------------------------------------------------------------------------
/upload/carrierwave_file/config/initializers/assets.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Version of your assets, change this if you want to expire all your assets.
4 | Rails.application.config.assets.version = '1.0'
5 |
6 | # Add additional assets to the asset load path
7 | # Rails.application.config.assets.paths << Emoji.images_path
8 |
9 | # Precompile additional assets.
10 | # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
11 | # Rails.application.config.assets.precompile += %w( search.js )
12 |
--------------------------------------------------------------------------------
/upload/carrierwave_file/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5 |
6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7 | # Rails.backtrace_cleaner.remove_silencers!
8 |
--------------------------------------------------------------------------------
/upload/carrierwave_file/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.action_dispatch.cookies_serializer = :json
4 |
--------------------------------------------------------------------------------
/upload/carrierwave_file/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Configure sensitive parameters which will be filtered from the log file.
4 | Rails.application.config.filter_parameters += [:password]
5 |
--------------------------------------------------------------------------------
/upload/carrierwave_file/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new mime types for use in respond_to blocks:
4 | # Mime::Type.register "text/richtext", :rtf
5 |
--------------------------------------------------------------------------------
/upload/carrierwave_file/config/initializers/session_store.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.session_store :cookie_store, key: '_carrierwave_file_session'
4 |
--------------------------------------------------------------------------------
/upload/carrierwave_file/db/migrate/20150323160514_create_products.rb:
--------------------------------------------------------------------------------
1 | class CreateProducts < ActiveRecord::Migration
2 | def change
3 | create_table :products do |t|
4 | t.string :name, null: false
5 | t.string :image
6 | t.timestamps null: false
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/upload/carrierwave_file/db/seeds.rb:
--------------------------------------------------------------------------------
1 | # This file should contain all the record creation needed to seed the database with its default values.
2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3 | #
4 | # Examples:
5 | #
6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7 | # Mayor.create(name: 'Emanuel', city: cities.first)
8 |
--------------------------------------------------------------------------------
/upload/carrierwave_file/lib/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/upload/carrierwave_file/lib/assets/.keep
--------------------------------------------------------------------------------
/upload/carrierwave_file/lib/tasks/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/upload/carrierwave_file/lib/tasks/.keep
--------------------------------------------------------------------------------
/upload/carrierwave_file/log/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/upload/carrierwave_file/log/.keep
--------------------------------------------------------------------------------
/upload/carrierwave_file/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/upload/carrierwave_file/public/favicon.ico
--------------------------------------------------------------------------------
/upload/carrierwave_file/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2 | #
3 | # To ban all spiders from the entire site uncomment the next two lines:
4 | # User-agent: *
5 | # Disallow: /
6 |
--------------------------------------------------------------------------------
/upload/carrierwave_file/vendor/assets/javascripts/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/upload/carrierwave_file/vendor/assets/javascripts/.keep
--------------------------------------------------------------------------------
/upload/carrierwave_file/vendor/assets/stylesheets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rails-Application-Build-Guides/rails-application-build-guide-sample/8a6e2f6dddff9a5fb88b03e6f69e5445b4cb4d96/upload/carrierwave_file/vendor/assets/stylesheets/.keep
--------------------------------------------------------------------------------