LoginSignup
9
13

More than 5 years have passed since last update.

[ECサイト]Rails製Solidus(v2.3.0)を触りだけやってみた

Last updated at Posted at 2018-07-08

目的

  • Rails製Solidusを使うとECサイトがサクッと作れるらしんでやってみたことをメモ
  • solidusのGitHub

条件

  • ruby 2.4.1
  • Rails 5.1.6
  • psql (PostgreSQL) 10.4
  • Solidus(v2.3.0)

[DB]MacにPostgreSQLをインストールする方法

手順

  1. プロジェクトフォルダを作成し、solidus関連のGemを導入
  2. Gemをインストール後、指定されたコマンドで必要なファイルを作成
  3. サーバーを起動してViewを確認

1. プロジェクトフォルダを作成し、solidus関連のGemを導入

プロジェクトファイルを作成し、移動
mkdir solidus && cd $_
お決まりのnew/DBはpostgresql
rails _5.1.3_ new ./ -B -d postgresql --skip-turbolinks --skip-test
Gemfile
# 下記2つを追加
gem 'solidus'
gem 'solidus_auth_devise'
お決まりのbundle
bundle install --path vendor/bundle --jobs=4

[開発環境]プロジェクトごとにrailsの開発環境を設定する方法

2. Gemをインストール後、指定されたコマンドで必要なファイルを作成

yarnで「AdminLTE3.0.0-alpha.2」をインストール
# GitHubのREADMEを参照

bundle exec rails g spree:install

----
# 途中、管理ユーザーを作成するため、メール/パスワードを聞かれます

Create the admin user (press enter for defaults).
Email [admin@example.com]: ()test@sample.com
Password [test123]: ()111111
----

bundle exec rails g solidus:auth:install
bundle exec rake railties:install:migrations
DBに反映させる
# GitHubのREADMEを参照

bundle exec rake db:migrate

3. サーバーを起動してViewを確認

サーバー起動
rails s

フロント画面

Image from Gyazo

管理画面ログイン(http://localhost:3000/admin/login)

Image from Gyazo

管理画面

Image from Gyazo

最後に

驚くほど簡単にできた。というか、ほぼコマンド入力のみの作業だけで終了した
カスタマイズするにはもっとやらないといけないけど、今はそんな時間ないので時がきたらやります。

Rails製SolidusとStripeでカード決済対応のオンラインストアをつくる

9
13
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
9
13