Wrap condition,order etc in a proc or lambda. Limit sass-rails to 4.0.1,limit sprockets to 2.11.0

Upgrade rails to '4.0.10'. Error when login as admin. Login in as student and TA is fine.

bundle exec rspec: 1 error and some deprecation warnings. (need to be fixed)
bundle exec rake test: some errors and deprecation warnings. (need to be fixed) (shoulda and minitest problem)
Avoid using {...} for multi-line blocks.