LoginSignup
3
3

More than 5 years have passed since last update.

SPREE + Devise でアプリケーションを立ち上げるまで

Last updated at Posted at 2015-06-24

1)Gemfileにspree関係のgemを追加

#今回はmysqlを利用する
gem 'mysql2'

#spree
gem 'spree', github: 'spree/spree', branch: '3-0-stable'
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '3-0-stable'

2)$ bundle install --path vender/bundle
3)rails g devise:install
4)database.ymlにDatabase設定を記載

database.yml
development:
  adapter: mysql2
  database: mystore
  username: root
  password:
  encoding: utf8

test:
  adapter: mysql2
  database: mystore_test
  username: root
  password:
  encoding: utf8

5)config/initializers/devise.rbを修正

config/initializers/devise.rb
  # The secret key used by Devise. Devise uses this key to generate
  # random tokens. Changing this key will render invalid all existing
  # confirmation, reset password and unlock tokens in the database.
  config.secret_key = 'シークレットキーの値が入っています'
.
.
中略
.
.
  # ==> Mailer Configuration
  # Configure the e-mail address which will be shown in Devise::Mailer,
  # note that it will be overwritten if you use your own mailer class
  # with default "from" parameter.
  # メーラー設定
  # Devise::Mailerのメールアドレスを設定します。
  # もし、デフォルトパラメータの設定されためmailer classを利用するなら、
  # 上書きされることに注意して下さい。
  config.mailer_sender = 'no-reply@sample.com'
.
.
中略
.
.
  # ==> Configuration for :confirmable
  # A period that the user is allowed to access the website even without
  # confirming their account. For instance, if set to 2.days, the user will be
  # able to access the website for two days without confirming their account,
  # access will be blocked just in the third day. Default is 0.days, meaning
  # the user cannot access the website without confirming their account.
  # 確認設定
  # ある期間ユーザーはアカウントを確認せずにサイトにアクセスすることが出来ます。
  # ~ 以下略 ~ (許可される期間が2日とか3週間とか何とか...)
  config.allow_unconfirmed_access_for = nil
.
.
中略
.
.
  # Email regex used to validate email formats. It simply asserts that
  # one (and only one) @ exists in the given string. This is mainly
  # to give user feedback and not to assert the e-mail validity.
  # config.email_regexp = /\A[^@]+@[^@]+\z/
  # メールアドレスのバリデーション
  config.email_regexp = /\A[[^@\s]&&[ -~。-゚^,]&&[^,]]+@([[^@\s]&&[ -~。-゚]&&[^,]]+\.)+[[^@\s]&&[ -~。-゚]&&[^,]]+\z/
.
.
中略
.
.
  # Time interval you can reset your password with a reset password key.
  # Don't put a too small interval or your users won't have the time to
  # change their passwords.
  # パスワードをリセットするためのキーでリセット出来る期間について。
  config.reset_password_within = 2.weeks
.
.
中略
.
.
  # ==> Scopes configuration
  # Turn scoped views on. Before rendering "sessions/new", it will first check for
  # "users/sessions/new". It's turned off by default because it's slower if you
  # are using only default views.
  # スコープの設定
  # ログインしてないと接続できるのはサインアップだけとか何とか...
  config.scoped_views = false

6)rails g spree:install
対話形式で設定

3
3
0

Register as a new user and use Qiita more conveniently

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