プロジェクト

全般

プロフィール

Vote #64416

完了

Named scopes in Issue and ActsAsWatchable plus some view refactoring (logic extraction).

Admin Redmine さんが約3年前に追加. 約3年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Code cleanup/refactoring_30
対象バージョン:
開始日:
2009/01/09
期日:
進捗率:

100%

予定工数:
category_id:
30
version_id:
14
issue_org_id:
2482
author_id:
2175
assigned_to_id:
5
comments:
3
status_id:
5
tracker_id:
3
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

Added named_scope in Issue and ActsAsWatchable replacing custom finder method declarations in model classes and custom find queries in views.

More specifically this patch introduces the following changes:

  • Replaces @watched_by@ class method in ActsAsWatchable with a @named_scope@ of the same name (so no API breaking)
  • Adds @Issue::recently_updated@, @Issue::with_limit@ and @Issue::on_active_project@ which are optional but handy. If they seem reduntant they can be removed and update the views accordingly (see next bullet)
  • Removes DB logic from partial view @my/blocks/_issueswatched.rhtml@ which falls back to new named scopes. It would be even better if this thing was inside the controller (that is the right place) but because of the modularity of my/page (due to the blocks) I didn't touch it.

plus:

  • Tests for introduced changes

and

  • Minor documentation for introduced changes

Patch is against trunk r2250.

Note: If you find it useful I could also refactor other parts of redmine, replacing custom finders with named scopes (if possible) and extracting model logic from views. Just let me know, or simply apply this patch :)


journals

I'll take a look at this patch and see about appling.

> Note: If you find it useful I could also refactor other parts of redmine, replacing custom finders with named scopes (if possible) and extracting model logic from views. Just let me know, or simply apply this patch :)

I would find that really useful. I've been waiting for 0.8 to be released before I went through refactoring. If you use git, could you branch from my "GitHub":http://github.com/edavis10/redmine/tree/master repository and send me the patches through GitHub? It makes it easy to review and apply them.

Thanks
--------------------------------------------------------------------------------
http://github.com/nikosd/redmine/commit/d5d84e8f859be8873be76589b2814b567cac2fce
--------------------------------------------------------------------------------
Committed in r3557
--------------------------------------------------------------------------------

Admin Redmine さんが約3年前に更新

  • カテゴリCode cleanup/refactoring_30 にセット
  • 対象バージョン1.0.0 (RC)_14 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0