Skip to content
A short Rails coding example for a prospective employer. The Challenge details are listed in README, along with some notes on implementation. This is just a sample and by no means complete. I could spend days or weeks improving it in various ways...
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
app
config
db
doc
lib/tasks
public
script
test
vendor/plugins
.gitignore
.project
Gemfile
Gemfile.lock
README
README.rails
Rakefile
config.ru

README

Rails Exercise:
===============
We'd like you to create a simple Rails 3 application.
Create models that allow a user to follow another user.
The user model's only attribute is "name". You may scaffold the create action.
Create an interface that accepts post requests that allows users to
"follow" other users.

The user's "index" action should list all of the users.
The user's "show" action should show:
1) The user's name
2) The users the user is currently following (with a button to remove
that following)
3) The users the user is not following (with a button to add that following)
4)  The users currently following this user
Do not create a login system for this exercise.


THOUGHTS / EXPLANATIONS
========================
* added scope :without_user to User model to allow for removing the passed user from results for non followers query - we may want to re-use this
* no pagination was put in place due to approaching this as more of a logic exercise and less of a complete site exercise
* added ability to remove users from user list screen - would be accessible to administrators only
* following and followers lists on profile page show text when no users are found for the query
* the "all users you are not following" block is not displayed if there are no more users to follow.
* a default avatar has been chosen 
* used default sqlite3 DB to allow for base data.  For clean view of application:
    * rm -rf db/development.sqlite3
    * rake db:create
    * rake db:migrate
* the DB would normally have a rake task to populate with sample data, but this exercise was about the follow logic


IMPROVEMENTS:
=============
* better security around which user scaffold actions are accessible
* remove cruft added by scaffold and rails project generation that is not needed/used
* remove unused icons from icon sets
* better abstraction of modular code into individual views instead of being in-line to be more repeatable (userBlocks & userBlock <div>s for one)
* unit tests to verify logic always works as expected with additional changes.
* more profile information
* ability to post a custom avatar
* logins and ability to then use 'current_user' instead of passing it as hidden field in forms.
* administrator ability to perform actions for people
* more interesting data (posts, feed, etc) than just a picture of your followers
* better UI
* more flexible UI for followers to show more on one page
* add pagination
* e-mails (configurable as to which you get)
    * when someone follows you - with a link to follow them back
    * daily/weekly/etc with information shared by those you follow
    * each time someone you follow has action
Something went wrong with that request. Please try again.