Refactor topic (PR #884)

Made changes to the validation to make it more Rails 3 idiomatic and to move things that are not strictly validation out of that and into a more appropriate place. Also began putting the validation error messages into the correct place in the I18n files, so Rails can find them easily by key. Fixed some wording in the tests, and provided a spec to show a good way of testing custom validators. BTW - the validation tests for topic were flawed. Using a string of ‘xxx’ fails the quality validation, and so the fact that the length validation tests were broken was never picked up, since the specs only looked at valid or not, not the message or the attribute.

GitHub

You’ve signed the CLA, mattvanhorn. Thank you! This pull request is ready for review.

A commit that appears in this pull request is being discussed here.

I like this change, can you omit the localization file changes (except for English)

just curious, @mattvanhorn did you use any tool to generate topic’s schema information?

annotation is controversial, let’s leave it out and discuss on meta. certainly don’t want a situation where only some stuff is annotated, its either all or nothing and we need a strategy to keep up to date if we go for this.

The tool for annotation is https://github.com/ctran/annotate_models - I will revert that commit. Can I ask why the localization changes should be omitted?

wrt localization, only worry about English, the rest of the files can remain untouched.

On Thu, May 23, 2013 at 11:39 PM, Matt Van Horn notifications@github.comwrote:

The tool for annotation is https://github.com/ctran/annotate_models - I will revert that commit. Can I ask why the localization changes should be omitted?

— Reply to this email directly or view it on GitHubhttps://github.com/discourse/discourse/pull/884#issuecomment-18343597 .

Love it, thanks so much! :fish: