Clean up metric_fu violations
Clean up many of our violations. Most of these are meaningless fixes that do not resolve the actual issue. For example, we use delegate to remove the law of demeter violations, but that doesn't really resolve the issue. We pass some more stuff though and that's good enough for now.
See merge request !23
Add a quick front apge
Hack in a front page so that we can keep trucking along. This uses posts#index to show all posts. We also added some title stuff in this commit.
See merge request !21
Fix uniqueness issues with Faker
Faker will not always make unique data. Let's toss a sequence on fields that require uniqueness.
See merge request !18
Add comments to creddit
Initial pass at commenting with some things left to consider. Primarily, double nesting of resources is advised as poor practice. Investigate alternatives. Testing on comments isn't entirely complete (delete missing and some other things). Comment replies need to be moved to inline.
See merge request !15
Fix some law of demeter violations
```
@post.user.username
```
is not good
```
delegate :username, to: :user, prefix: true
@post.user_username
```
is apparently good? Although I've never really seen the advantage since I feel like we're just masking an underlying problem. But at least it looks a little nicer.
See merge request !14
Layout fixes to be closer to reddit
Design setup closer to Reddit. Sidebar, header, posts, etc. Hacky for now. Fix later after spending more time in views.
See merge request !12
Add posts
Not complete, but implemented basic posting to subcreddits. Right now, links aren't taken into account (but basic modeling is in). Enough to continue.
See merge request !11
Notes on closing subcreddit:
This doesn't seem great. Would be slightly better if closed could be referenced
as true or false instead of '0' or '1' in the model. Testing this is a bit
messy, but Tiemcop makes it a bit better.
Notes on subcreddit validations:
This is still not ideal. For starters, from
http://guides.rubyonrails.org/active_record_validations.html:
"Note that some databases are configured to perform case-insensitive searches
anyway."
It also seems difficult to validate fields that are set in before_save since
validations occur before callbacks. Revisit this (perhaps friendly_id wll save
us).
Add user sessions
Although rails provides built-in user sessions, this allows us to add additional fields to the session model. For example, we can now track the user agent and IP address of all sessions associated with a user. Long term, this allows us to do neat things like session revocation (by both user and admin) and sudo mode.
See merge request !5
Add user creation
Adds simple creation of users that have a username, password, and an email. The password is managed by Rail's `has_secure_password`.
See merge request !2