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.
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 or clone the project from Github
- 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.
- 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 the problem you are experiencing is not listed above – I suggest you get help on Stack Overflow.
- Rails: 188.8.131.52
- MongoID: 6.0.0
- Bcrypt 3.1.11
- Add Product
- Edit Product
- Manage Products
- Product List
- Single Product View
If you are a developer and you would like to contribute to this project, please follow my guidelines bellow:
- ALWAYS start a new branch before making changes to the codes
- Pull requests directly to the master branch will be ignored!
- Use a git client, preferably Source Tree or you can use git commands from your terminal, your choice!
- Many smaller commits are better than one large commit. Edit your file(s), if the edit does not break the code with things like syntax errors, commit. It is easier to reconcile many smaller commits than one large commit.
- When your feature or bug fix is ready, perform a pull request and notify firstname.lastname@example.org that your code is ready for review on Github.