Use rake spec to run tests instead of rspec spec [ci skip]
[core] various refactoring:

* Use ruby19 hash syntax
* Add lambda to scopes
Fix removal of polymorphic associations
Merge branch 'fix-remove-polymorphic' into develop