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
Guest
user and he/she will be allowed to see only blogs present in the system.
- Ruby > 2.2.x
- Clone the repo using
git clone [email protected]:kuldeepaggarwal/blog_api.git
- Checkout to
development
branch as this is upto date branch - Run
bundle install
. - Create configuration files from their respective
.example
files in config folder. For Example: copydatabase.yml.example
intodatabase.yml
- Create database using
rake db:create
command - Run any migrations using
rake db:migrate
command - Run the seeds for the project using
rake db:seed
command - Run Rails Server using
rails s
command
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.