It is a blog api where a user can create blogs and can comment on it. For the security concerns we have different roles of a user.
- Admin: He is the one who have the authority to manage everything in the system. He can create users/blogs/comments.
- Blogger: This user can create blogs/comments and edit/update his/her own blogs/ comments.
- Guest: Any user who is not logged in will be treated as
Guestuser and he/she will be allowed to see only blogs present in the system.
- Ruby > 2.2.x
- Clone the repo using
git clone git@github.com:kuldeepaggarwal/blog_api.git - Checkout to
developmentbranch as this is upto date branch - Run
bundle install. - Create configuration files from their respective
.examplefiles in config folder. For Example: copydatabase.yml.exampleintodatabase.yml - Create database using
rake db:createcommand - Run any migrations using
rake db:migratecommand - Run the seeds for the project using
rake db:seedcommand - Run Rails Server using
rails scommand
We have new approach to seed data per environment.
For this, we can create specific file, where environment can be any valid rails environment, like: development, test, production and so on, in db/seeds folder. Apart from this we have a special file db/seeds/all.rb where we can put seed data that will be common to all environment.
|___seeds | |___all.rb | |___development.rb | |___staging.rb | |___production.rb |___seeds.rb
$ cd [path-to-project]
$ bundle install
$ RAILS_ENV=test bundle exec rake db:create db:migrate db:seed
$ RAILS_ENV=test bundle exec rake spec- We should have the ability to create nested comments.
- All the permissions are hard coded, we should have a mechanism that an admin can give permissions to any user. Granular level permissions.
- We don't have feature to create roles dynamically.