Fixed rubocop warnings in attributes and associations

With this pull the lib folder is almost clean. All is left are warnings that we should look more carefully.

I will send another pull request with the changes on the spec folder. =)