Remove models/roles and return to fat models
Created by: dzaporozhets
After half of year with models roles I'd like to remove them from system Reasons below:
- its difficult to define where method goes (role or model)
- roles are closely connected to model fields so changing model requires changing some or roles
- its easily to duplicate method already defined in another role
- testing roles requires a model anyway
- it is complicated to search for method having few roles
So I suggest to return to fat models + libs
I saved Vote, IssueCommonality, StaticModel as libs. Also I am going to extract Repository from project in future in separate class in libraries
Feedback from core team is appreciated
Merge request reports
Activity
Created by: riyad
But I'd say the roles that survive should go into the
app/models
directory. It's generally clear from the name, that some files are not AR models. "GitHost" is basically a one-liner and could be merged into Project (why is it calledgit_host
when all the docs say it's about Gitolite? maybe it should be calledgitolite
orgitolite_bridge
).Voteable
can also be merged intoIssueCommonality
.By Administrator on 2013-01-02T23:02:39 (imported from GitLab project)
By Administrator on 2013-01-02T23:02:39 (imported from GitLab)
Created by: SaitoWu
Fat models has its problem, cause its toooo fat.
I like the idea from @dhh, also it will be default on Rails 4.
app/models/concerns and app/controllers/concerns
Also DHH wrote a blog for it: http://37signals.com/svn/posts/3372-put-chubby-models-on-a-diet-with-concerns
Github commit: https://github.com/rails/rails/commit/f6bbc3f582bfc16da3acc152c702b04102fcab81
On the other hand , a test shows that 'DCI' is so slow.
https://gist.github.com/4321750
By Administrator on 2013-01-03T03:32:58 (imported from GitLab project)
By Administrator on 2013-01-03T03:32:58 (imported from GitLab)
Created by: dzaporozhets
Thank you for suggestions.
- Will remove githost
- Merge vote into issue commonality
- Move issuecommonality into models/concerns
- Extract repository in separate class
By Administrator on 2013-01-03T06:13:34 (imported from GitLab project)
By Administrator on 2013-01-03T06:13:34 (imported from GitLab)