Update scopes and has_many conditions to rails 4 syntax

Prevents rails 4 deprecation warnings.
Also added bundler Gemfile for easier running of the tests.