Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nil errors on inconsistent data all over site #776

Open
mathias opened this issue Sep 4, 2013 · 1 comment
Open

Nil errors on inconsistent data all over site #776

mathias opened this issue Sep 4, 2013 · 1 comment
Labels

Comments

@mathias
Copy link
Contributor

mathias commented Sep 4, 2013

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
Copy link
Contributor

I love decorators and the null object pattern.
On Sep 4, 2013 11:45 AM, "Matt Gauger" [email protected] 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//issues/776
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants