Ruby on Rails (aka Rails) is one of the most popular web application framework in the planet. It is designed to eliminate much of the drudgery of writing typical web applications by providing default settings that eliminate most configuration code (“convention over configuration”) and by providing a rich set of utility functions that make most common tasks simple. With Ruby as its core programming language – it makes it so much easier to write robust web applications that will scale as you need them to and be easy to maintain as you go forward.
This simple e-commerce application demonstrates CRUD operations using mongoDB and a simple implementation of a cookie based user authentication using Bcrypt. I specifically built this application to serve as a default template for building medium to large-scaled e-commerce applications.
- Multi Vendor E-commerce – customers can register for an account and be able to upload and sell their products.
- User Authentication and Account management.
- Create Product, Edit Product, and Manage Products
- Bulk upload product images, delete product images, and Set Features image of a product,
- User products and Catalog filtering which includes: Per Page Display, Search, Ordering, Sorting and Pagination.
- Word class inline image slider with zooming and panning functionality.
- WYSIWYG rich text editor for writing content
- Responsive web design – utilizes Bootstrap 3.
- All actions are processed via AJAX for better performance.
This project is available for testing on Heroku. Unfortunately you wont be able to test the image upload as Heroku does not allow writing of files within their file system. Check out the demo
- Download the zip file
- Open your terminal then navigate to where you installed MongoDB. In my case it’s located under C:/mongodb/
- From the root directory of your Mongodb installation, go to bin folder then run: mongod.exe to initialize the Mongodb database server
- Open another terminal then navigate to where you extracted the project files.
- Run bundle install to install all project dependencies.
- Run the migration: rails db:migrate
- Finally run: rails server to start the Web Server.
- Open up your favorite browser then go to http://127.0.0.1:3000
Possible Installation issues:
- If you are experiencing problems with SQLite3, follow instructions here: https://github.com/hwding/sqlite3-ruby-win, If still not working, and you are getting errors similar to bellow:
require: cannot load such file — sqlite3/sqlite3_native (LoadError)
- Solution 1:
- Go to your rails app then open gemfile.lock
- Then look for the line “sqlite3” and change its version to the version you have installed in your computer.
- Then run bundle install
- Solution 2:
- Go to C:\Ruby23-x64\lib\ruby\gems\2.3.0\specifications
- Look for: sqlite3-1.3.7.gemspec file then open it.
- Change s.require_paths=[“lib”] to s.require_paths= [“lib/sqlite3_native”]
- Solution 1:
- If you’re getting error related to Bcrypt like the one bellow, follow the tutorial I created here: http://carlofontanos.com/setting-up-bcrypt-for-rails-on-windows
- C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/activesupport-4.0.0/lib/active_support/depen dencies.rb:228:in ‘require’: 126: The specified module could not be found. – C :/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bcrypt-ruby-3.1.11-x64-mingw32/lib/bcrypt_ext.so (LoadError)
- If you encountered the following error:If you encountered the following error: C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bcrypt-3.1.11-x64-mingw32/lib/bcrypt.rb:16:in `require’: cannot load such file — bcrypt_ext (LoadError)
- Uninstall all versions of bcrypt with “gem uninstall bcrypt” and select option 3 (if it exists),
- And uninstall all versions of bcrypt-ruby gem with “gem uninstall bcrypt-ruby” and select option 3 (if it exists),
- Then I install bcrypt using “gem install bcrypt –platform = ruby“
- Then add this line gem ‘bcrypt’, ‘~> 3.1.11’ in Gemfile.
- If the problem you are experiencing is not listed above – I suggest you get help on Stack Overflow.
- Ruby: 2.4.2-2
- Rails: 5.0.3
- MongoID: 6.0.0
- Bcrypt 3.1.11
- Add Product
- Edit Product
- Manage Products
- Product List
- Single Product View
- Checkout system
- Cart Page
- Wish List
- Ratings and Reviews