Hello, there! This is a challenge application that will test your practical knowledge of following tools:
- Ruby programming language
- Ruby on Rails web framework
- Git version control system
- Get the code
Before you start you need have git installed on your machine. If you're not familiar with it yet, just take a CodeSchool's free course. It's short and fun.
When ready, clone this repository. Please do not fork it, because it would make your code visible to other challengers. We don't want this.
Issue the following command from the console.
`git clone --origin academy https://github.com/hussar-academy/challenge_app`
If you don't have a GitHub account yet, now is the perfect time to create one. Then create a repository named challenge_app
and push the code.
```
git remote add origin git@github.com:your-username/challenge_app.git
git push --set-upstream origin master
```
- Install ruby
The actual procedure will depend on your operating system. If you're on OS X or Linux (recommended development platforms) consider using RVM or rbenv. On Windows RubyInstaller should do the trick. Either way you'll need ruby version 2.0 or higher.
- Install dependencies
This step is as easy as running:
`bundle`
The command will install all dependent libraries that are used in the application.
- Create database
The application is set up to use SQLite database, so you may need to install it first on your system. Then fire the command:
`bundle exec rake db:create db:migrate`
It will first create an empty database and then migrate its stucture.
- Start the application
Now you should be ready to start the application. Just use the following command and the app should be running at http://localhost:3000:
`bundle exec rails server`
- Write some code and show off your work!
From now on, you're on your own. Read the Specification and Development Guidelines below and check the Resources for hints on where to look for help.
Good luck!
The application is a question and answer site with features similar to Stack Overflow but it still needs some work.
Don't worry if you're not able to complete all the features, do as many as you can. When you're done push your code to your GitHub repository so that we can access it and test. Bonus points for deploying the application to Heroku. Then write us an e-mail at academy@hussa.rs with the links.
Most of the listed features can be implemented using core mechanisms of Ruby on Rails, reading the framework's guildelines will surely point you in right directions. Other ones may rely on external libraries (gems).
- Users need to create profiles to add questions and answers.
- Question has title and contents. Title should be required.
- Answer has only contents. It should be required.
- Users can update their questions, but not answers.
- Users can like answers added by users. It should be visible how many likes each answer has received.
- Question's author can accept one answer to the question. This answer should be marked as "Accepted".
- No one can add new answer to a question that already has an accepted answer.
- Users collect points. New users get 100 points for free.
Hint: Define user.points
attribute.
- When user's answer is accepted she receives 25 points, when liked she receives 5 points.
- Creating a question costs 10 points.
- Users can set their names and it should be displayed everywhere instead of e-mail.
Hint: User profiles are implemented using devise gem. Check its documentation to find out how to handle additional attributes on registration and edit profile pages.
- Users can upload avatars which should be automatically scaled to 100x100px size.
Hint: Use a gem that handles file uploads and image manipulation.
-
Once a user reaches 1000 points, she receives Superstar badge that is visible on his profile page.
-
Question's author receives e-mail notification when someone answers his question.
-
User receives e-mail notification when his answer is accepted.
-
There is a leaderboard page where users are sorted by points.
-
E-mails are sent via background jobs.
Often in production environments, time consuming tasks are performed in background, not during user's request. Sending e-mails is such a task because it involves communication with remote servers which may be slow or may not respond. We do not want to make our user wait that long for the response, so we need to respond immediately as if the e-mail has been succesfully sent, but send it in background.
- Users can login using their GitHub accounts.
People don't like passwords. To make it easy for them many sites allow logging in with Facebook, Twitter or GitHub accounts in a secure way. We're going to use just GitHub.
- Liking answers should not reload the page.
Let's improve user experience a bit. When user likes an answer he should immediately see the result without reloading the whole page. Hint: Try using jQuery javascript library to perform AJAX requests.
- Questions and aswers can be written in Markdown format.
This README
file is in Markdown. GitHub automatically formats it and displays a nice readable HTML, we want the same with question and answer contents.
- Create small, atomic commits.
- Try to use English for everything from variable names to commit messages.
- We're using slim templating engine for views, not ERB which is a default in Ruby world. It's quite easy, but if you don't feel comfortable, feel free to use ERB. The same thing stands for other gems. It's your code, use whatever suits you.
- Some features are defined in files in
features/features
directory. If you're curious, they're written in Cucumber and this is executable code. You can run it withbundle exec cucumber
and check if your code satisfies these definitions. - If you have any problems ask for help in our public Chat Room. We really mean it! There's nothing wrong in seeking advice. (Please pay attention to the topic message)
Here's the list of useful resources that might help you on your journey.
- https://www.codeschool.com/courses/try-git
- https://try.github.io
- https://www.atlassian.com/git/tutorial
- http://git-scm.com/book
- https://github.com/monterail/guidelines - Our own set of web development guildelines and best practices
See attached LICENSE.txt file.
Copyright (c) 2014 Monterail.com LLC