hotsh / rstat.us

Simple microblogging network based on the ostatus protocol.
http://rstat.us/
Other
722 stars 215 forks source link

Nil errors on inconsistent data all over site #776

Open mathias opened 11 years ago

mathias commented 11 years ago

So in setting up our own node, we played around in the rails console to create Users and Authors, since we couldn't get the login form to work initially. As a result, we had some orphaned Authors and some orphaned Updates.

What I see is that the site blows up because it is checking against id fields and calling other methods on associations that aren't there, especially on any page that uses the app/views/updates/_list.html.haml partial.

What I'd expect is that the site is resilient against bad data and simply doesn't display it, as well as some model logic to clean up orphaned associations on save.

This issue covers a wide range of things. It looks like there's a lot of database lookups happening in views, as well as a lot of Law of Demeter violations when walking current_user.author.some_method -- it looks like a lot of the models are really begging for a Decorator pattern to be applied.

I can start to write some test cases to reproduce bugs I've seen, but I think it might be worth discussing a plan of attack so that we can all agree on the best way (Decorators, extracting logic from views into controllers or helpers?) before beginning to try to solve this.

carols10cents commented 11 years ago

I love decorators and the null object pattern. On Sep 4, 2013 11:45 AM, "Matt Gauger" notifications@github.com wrote:

So in setting up our own node, we played around in the rails console to create Users and Authors, since we couldn't get the login form to work initially. As a result, we had some orphaned Authors and some orphaned Updates.

What I see is that the site blows up because it is checking against idfields and calling other methods on associations that aren't there, especially on any page that uses the app/views/updates/_list.html.hamlpartial.

What I'd expect is that the site is resilient against bad data and simply doesn't display it, as well as some model logic to clean up orphaned associations on save.

This issue covers a wide range of things. It looks like there's a lot of database lookups happening in views, as well as a lot of Law of Demeter violations when walking current_user.author.some_method -- it looks like a lot of the models are really begging for a Decorator pattern to be applied.

I can start to write some test cases to reproduce bugs I've seen, but I think it might be worth discussing a plan of attack so that we can all agree on the best way (Decorators, extracting logic from views into controllers or helpers?) before beginning to try to solve this.

— Reply to this email directly or view it on GitHubhttps://github.com/hotsh/rstat.us/issues/776 .