Online Store with Solidus (Part 1)
Ecommerce using solidus (spree's alternative)
Since spree has been sold, I thought it might be good idea to setup tutorial to create ecommerce with alternative.
Here we will use <a href=https://github.com/solidusio/solidus rel=“nofollow” target=“_blank”>solidus which is a complete open source e-commerce solution built with Ruby on Rails. It is a fork of Spree.
New Rails Project
Lets start with setting up new rails project.
rails _4.2.6_ new merchant -T -B --database=mysql
# -T skips unit test (we will use rspec)
# -B skips the bundle install after all files have been generated
# --database=mysql specifies database to be used is mysqlNow cd to the project directory and let’s init git
cd merchant
git initYou may copy .gitignore content from <a href=/setup-new-rails-project/ target=“_blank”>here to avoid tracking unnecessary files to your repo.
Create .ruby-version to specify ruby version.
echo '2.3.1' > .ruby-versionAdding Solidus gem
Now let’s add solidus to our gemfile:
gem 'solidus'
gem 'solidus_auth_devise'Run the bundle command to install.
$ bundleAfter installing gems, let’s setup database. My config/database.yml looks like this:
default: &default
adapter: mysql2
encoding: utf8
pool: 5
username: root
password:
socket: /var/run/mysqld/mysqld.sock
development:
<<: *default
database: merchant_development
test:
<<: *default
database: merchant_test
production:
<<: *default
database: merchant_production
username: merchant
password: <%= ENV['MERCHANT_DATABASE_PASSWORD'] %>Now you need to run `rake db:create’ command to create database.
Then, you’ll have to run the generators to create necessary configuration files and migrations.
bundle exec rails g spree:installThis may take a while but after some time you will be prompted to create admin user. Enter email and password and youe will see success message.
Create the admin user (press enter for defaults).
Email [spree@example.com]: prakashpoudel@lftechnology.com
Password [spree123]:
Done!
loading sample data
insert config/routes.rb
**************************************************
We added the following line to your application's config/routes.rb file:
mount Spree::Core::Engine, :at => '/'
**************************************************
Spree has been installed successfully. You're all ready to go!
Enjoy!
The line below is copied from solidus’s instruction and I expected it to copy migrations to my app but my terminal gave me no hint what it did! Then I ran rake db:migrate and again terminal gave no hint of what was happening but I guess that won’t cause me problem because bundle exec rails g spree:install has already installed necessary migrations.
bundle exec rake railties:install:migrationsLet’s see the output of our hardwork now! Run rails server!
rails sVisit <a href=http://localhost:3000/ rel=“nofollow” target=“_blank”>http://localhost:3000/ to see your store.
Your admin section will be in <a href=http://localhost:3000/admin rel=“nofollow” target=“_blank”>http://localhost:3000/admin

We will do slight customisations of this store in next post.
Keep reading
Fix mise GitHub Rate Limit with a Token
mise makes unauthenticated GitHub API calls by default. When you hit the rate limit installing tools, a personal access token (no scopes required) fixes it permanently.
How to solve Deployment Failure-`assets:precompile`
I was trying to deploy rails 6 app on ec2 server using capistrano when precompile failure lead to whole deploymentt failure. I had to uninstall cmdtest and install yarn
How to Sort an Array of Objects in JavaScript
How to Sort an Array of Objects in JavaScript
What did you take away?
Thoughts, pushback, or a story of your own? Drop a reply below — I read every one.
Comments are powered by Disqus. By posting you agree to their terms.