Permalink
Browse files

Minor refactorings.

  • Loading branch information...
1 parent 4a06531 commit e87553831851d9cb06c3ec4919abbdb44565075c @tute tute committed Oct 13, 2012
Showing with 7 additions and 9 deletions.
  1. +2 −3 README.md
  2. +3 −4 lib/merit/model_additions.rb
  3. +2 −2 lib/merit/models/active_record/sash.rb
View
5 README.md
@@ -134,14 +134,13 @@ end
# To-do list
-* add an error handler for inexistent badges.
+* add an error handler for inexistent badges (`rule.rb#74`?).
+* Translate comments from spanish in `rules_badge.rb`.
* Should namespace app/models into Merit module.
-* rescue ActiveRecord::... should depend on ORM used
* :value parameter (for star voting for example) should be configurable
(depends on params[:value] on the controller).
* Make fixtures for integration testing (now creating objects on test file!).
* Rules should be cached? Calling *Rules.new more than once
-* Add badges_sashes timestamps
---
View
7 lib/merit/model_additions.rb
@@ -17,12 +17,11 @@ def has_merit(options = {})
field :sash_id
field :points, :type => Integer, :default => 0
field :level, :type => Integer, :default => 0
+ def find_by_id(id)
+ where(:_id => id).first
+ end
end
end
-
- def find_by_id(id)
- Merit.orm == :mongoid ? where(:_id => id).first : super(id)
- end
end
def badges
View
4 lib/merit/models/active_record/sash.rb
@@ -6,13 +6,13 @@ def badges
end
def badge_ids
- badges_sashes.collect(&:badge_id)
+ badges_sashes.map(&:badge_id)
end
def add_badge(badge_id)
bs = BadgesSash.new
bs.badge_id = badge_id
- badges_sashes << bs
+ self.badges_sashes << bs
end
def rm_badge(badge_id)

0 comments on commit e875538

Please sign in to comment.