Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: merit-gem/merit
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.0.1
Choose a base ref
...
head repository: merit-gem/merit
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Feb 14, 2018

  1. Make sash optional

    tachyons committed Feb 14, 2018
    Copy the full SHA
    4436e38 View commit details

Commits on Apr 23, 2018

  1. Reproduce the rails 5.1 compatiability issue

    Rails 5.1 and above add automatic validation for belongs_to association.
    It is enabled by an initializer added to new projects. Adding that
    configuartion in dummy app will reproduce the issue in test case
    tachyons committed Apr 23, 2018
    2
    Copy the full SHA
    27c4a5c View commit details

Commits on Apr 24, 2018

  1. Merge pull request #287 from redtachyons/master

    Make Sash an optional dependency, fixing issues in Rails 5.1.
    tute authored Apr 24, 2018
    Copy the full SHA
    e3fb177 View commit details

Commits on Jun 24, 2018

  1. Update Ruby and Rails versions

    - Drops EOL'd Rails 5.0
    - Mocha doesn't need to be locked to an older version
    - Fix deprecation around `ActiveRecord::ConnectionAdapters::SQLite3Adapter.represent_boolean_as_integer`
    - Fix Travis CI issue: travis-ci/travis-ci#8969
    - Include fix in Rails 5-2-stable: rails/rails#31324
    tute committed Jun 24, 2018
    Copy the full SHA
    406fae3 View commit details

Commits on Jul 23, 2018

  1. Update dependencies

    tute committed Jul 23, 2018
    Copy the full SHA
    1a1856d View commit details
  2. Initialise merit for API only apps when needed

    Previously merit was initialised once when action_controller was loaded,
    but that could happen either for base or for API, and if the app was
    configured for the other one Merit wouldn't run.
    
    After rails/rails#28402 we can specifically hook
    in to web or API, thus removing the need for the `run_once` option.
    
    Thank you for your work on this, @jamesjefferies.
    
    [fixes #297]
    jamesjefferies authored and tute committed Jul 23, 2018
    Copy the full SHA
    3371034 View commit details
  3. Release merit v3.0.2, update NEWS

    [ci skip]
    tute committed Jul 23, 2018
    Copy the full SHA
    a571211 View commit details

Commits on Aug 14, 2018

  1. Fixed finder method

    * Added `.to_s` on `Merit::Badge#by_name`, so
    the method will always compare strings, even when
    we define badge names as symbols.
    dzcar committed Aug 14, 2018
    Copy the full SHA
    591122e View commit details

Commits on Oct 17, 2018

  1. Add "Reviewed by Hound" badge

    👋 @tute
    salbertson authored Oct 17, 2018
    Copy the full SHA
    50be966 View commit details

Commits on Feb 21, 2019

  1. Test with latest Ruby 2.6.1

    - Adds new ruby version to CI builds
    - Replaces `update_attributes` with `update`, in preparation for Rails 6.0 deprecation notice:
      DEPRECATION WARNING: update_attributes is deprecated and will be removed from Rails 6.1
    - Specify version of sqlite3 for tests
    jamesjefferies authored and tute committed Feb 21, 2019
    Copy the full SHA
    e24acbb View commit details

Commits on Jul 25, 2019

  1. Use find_each in Merit::Action.check_unprocessed (#332)

    Use find_each in favor of map
    
    - Process `Merit::Action.check_unprocessed` in batches
    psnider30 authored and tute committed Jul 25, 2019
    Copy the full SHA
    e23df0e View commit details

Commits on Aug 30, 2019

  1. Test against Rails 6

    - Drops `attr_accessible` pre-Rails 5 syntax
    - Drops testing scaffold for Mongoid
    - Drop patch versions for Ruby and Rails from travis configuration
    - Drop testing with EOL'd Ruby 2.3 and security maintenance 2.4
    tute committed Aug 30, 2019
    Copy the full SHA
    313ac06 View commit details
  2. Copy the full SHA
    be15e47 View commit details
  3. Release merit v3.0.3, update NEWS

    Removes Hound badge (I don't think it's still reviewing PRs here).
    tute committed Aug 30, 2019
    Copy the full SHA
    7c75bab View commit details

Commits on Sep 2, 2019

  1. Score points support bigint

    In production project, we encountered that integer is too short for
    storing score points.
    xofred committed Sep 2, 2019
    Copy the full SHA
    9271dc5 View commit details

Commits on Mar 27, 2020

  1. Copy the full SHA
    a80ba47 View commit details

Commits on Mar 29, 2020

  1. Remove some dummy testing models

    tute committed Mar 29, 2020
    Copy the full SHA
    b32f875 View commit details
  2. Remove Mongoid support

    Merit hasn't been running automated tests on mongo id since:
    
    ```
    commit c6ec066
    Author: Tute Costa <tutecosta@gmail.com>
    Date:   Sun Nov 9 14:27:10 2014 -0500
    ```
    
    I don't use it in any deployment with this configuration so I can't
    maintain it. I won't be able to test whether this code loads properly
    with Zeitwerk, so removing for now.
    
    If you need this code in your deployment, feel free to send a PR
    reverting this commit and ensuring CI runs tests against it.
    
    Also:
    
    - Stops testing on unmaintained Rails 5.1.
    - Drops unused JS files from dummy test app
    tute committed Mar 29, 2020
    Copy the full SHA
    4af5aec View commit details

Commits on Apr 25, 2020

  1. Drop v2 merit upgrade generators

    tute committed Apr 25, 2020
    Copy the full SHA
    cadecc5 View commit details

Commits on May 6, 2020

  1. Add info on namespaced controllers to README (#339)

    I think the Api namespace is definitely common enough to warrant its own
    little example? I wished I could have found this here instead of having
    to look through a lot of issue threads to finally understand this!
    Especially the model_name part on a namespace controller.
    
    Co-authored-by: Tute Costa <tutecosta@gmail.com>
    Xqua and tute committed May 6, 2020
    Copy the full SHA
    c8c792c View commit details
  2. Enable Zeitwerk gem mode

    - Fix ClassMethods file and class name
    - Auto load ActiveRecord models
    - Fix generators
    - `judge.public_send` in favor of bare `send`
    tute committed May 6, 2020
    Copy the full SHA
    9f1b6b0 View commit details

Commits on Jun 2, 2020

  1. Release merit v4.0.0, update NEWS

    [fixes #335]
    tute committed Jun 2, 2020
    Copy the full SHA
    bde91e0 View commit details

Commits on Jun 13, 2020

  1. Fix typo in active_record/merit_generator.rb (#345)

    Line #16 was referring to the migration_template source as 'add_merit_fields_to_model.rb'.
    This source does not exist as the actual extension is `.erb`. This caused the task
    to fail as there is no template with the name 'add_merit_fields_to_model.rb'.
    
    [fixes #344]
    jlholm authored Jun 13, 2020
    Copy the full SHA
    294fd12 View commit details

Commits on Jul 21, 2020

  1. Correct typo in initializer template

    will be used to grand badge => will be used to grant badge
    AMHOL authored and tute committed Jul 21, 2020
    Copy the full SHA
    ea936eb View commit details

Commits on Jul 22, 2020

  1. Remove :orm hooks

    Remove :orm hooks for the (now) unsupported generator options which
    were causing deprecation notices in thor versions > 1.0.0.
    Bo Tisdale authored and tute committed Jul 22, 2020
    Copy the full SHA
    622d74f View commit details

Commits on Aug 15, 2020

  1. Run ActiveRecord generators by default

    After enabling Zeitwerk mode I unintentionally disabled ORM default
    generators (9f1b6b0).
    
    This commit brings them back.
    
    [fixes #351]
    tute committed Aug 15, 2020
    Copy the full SHA
    587f8a4 View commit details
  2. Copy the full SHA
    cc73f1f View commit details
  3. Add note to the README on Observers behavior

    [closes #305]
    [closes #315]
    tute committed Aug 15, 2020
    Copy the full SHA
    0b13552 View commit details
  4. Observers bugfix

    Don’t send “removed badge” notifications when user doesn’t have the
    badge.
    
    [fixes #288]
    tute committed Aug 15, 2020
    Copy the full SHA
    c0dacca View commit details

Commits on Dec 29, 2020

  1. Test with Ruby 3 and Rails 6.1

    Excludes Rails 5.2 with Ruby 3, fails with:
    
    /home/travis/build/merit-gem/merit/vendor/bundle/ruby/3.0.0/gems/actionpack-5.2.4.4/lib/action_dispatch/middleware/static.rb:111:in
    `initialize': wrong number of arguments (given 3, expected 2) (ArgumentError)
    
    See https://travis-ci.org/github/merit-gem/merit/jobs/752017368
    tute committed Dec 29, 2020
    Copy the full SHA
    e67a411 View commit details

Commits on Apr 8, 2021

  1. Fixes Rails autoloader deprecation warnings (#354)

    Fixes:
    ```
    DEPRECATION WARNING: Initialization autoloaded the constants
    ActionText::ContentHelper, ActionText::TagHelper, Merit::BadgeRules, and
    Merit::PointRules
    ```
    
    Also fixes `DEPRECATION WARNING: Initialization autoloaded the constant Merit::Badge` by:
    
    - Wrapping `Merit::Badge.create` with
      `Rails.application.reloader.to_prepare` in `README.md`
    - Adding `Rails.application.reloader.to_prepare` to `merit.erb` template
    jairovm authored and tute committed Apr 8, 2021
    Copy the full SHA
    bc04e6d View commit details

Commits on Apr 9, 2021

  1. Add index on merit_actions.processed column (#356)

    * add index to migration template
    * add index to dummy app
    
    [closes #355]
    adrienpoly authored Apr 9, 2021
    Copy the full SHA
    537275d View commit details
  2. Copy the full SHA
    b002ab9 View commit details

Commits on May 25, 2021

  1. Fix merit_actions migration template (#357)

    if `add_index` is outside of the `def self.change` method, it's executed
    right away, and:
    
        Caused by:
        ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR:  relation "merit_actions" does not exist
    pirj authored May 25, 2021
    Copy the full SHA
    bd48a4d View commit details

Commits on Mar 5, 2022

  1. Fix: warning: previous definition messages (#363)

    When app reload is triggered, following warnings were spamming the console, especially running DelayedJob which reloads app every 5 seconds when running:
    
    Fix:
    If the constants are already defined, remove them first before setting again
    natanio authored Mar 5, 2022
    Copy the full SHA
    2dae5f0 View commit details
  2. Add webrick as a development dependency

    Otherwise Rails doesn't find a server for a test app in development
    mode.
    tute committed Mar 5, 2022
    Copy the full SHA
    4521b85 View commit details
  3. Copy the full SHA
    8a6fc95 View commit details

Commits on Mar 31, 2022

  1. Update Travis CI links

    [ci skip]
    tute committed Mar 31, 2022
    Copy the full SHA
    fe571c5 View commit details

Commits on Jul 6, 2024

  1. Convert project to GitHub Actions

    - Drops end-of-life'd versions of rails: 5.2 and 6.0, and ruby 3.0
    - Tests with current versions of Rails: 6.1, 7.0, 7.1
    - Mark 3 tests as pending to the open bug on deleted models
    tute committed Jul 6, 2024
    Copy the full SHA
    08e65bd View commit details
Showing with 1,477 additions and 10,268 deletions.
  1. +42 −0 .github/workflows/ci.yml
  2. +0 −11 .travis.yml
  3. +11 −0 Appraisals
  4. +7 −19 Gemfile
  5. +45 −0 NEWS.md
  6. +29 −11 README.md
  7. +16 −3 Rakefile
  8. +0 −256 UPGRADING.md
  9. +2 −19 app/models/merit/badge.rb
  10. +12 −0 gemfiles/rails_6_1.gemfile
  11. +253 −0 gemfiles/rails_6_1.gemfile.lock
  12. +12 −0 gemfiles/rails_7.gemfile
  13. +281 −0 gemfiles/rails_7.gemfile.lock
  14. +12 −0 gemfiles/rails_7_1.gemfile
  15. +281 −0 gemfiles/rails_7_1.gemfile.lock
  16. +0 −5 lib/generators/active_record/templates/add_target_data_to_merit_actions.rb
  17. +0 −40 lib/generators/active_record/upgrade_generator.rb
  18. +0 −16 lib/generators/merit/install_generator.rb
  19. +0 −7 lib/generators/merit/upgrade_generator.rb
  20. +29 −48 lib/merit.rb
  21. 0 lib/merit/{rules_badge_methods.rb → badge_rules_methods.rb}
  22. +1 −6 lib/merit/base_target_finder.rb
  23. +2 −19 lib/merit/{model_additions.rb → class_methods.rb}
  24. +4 −22 lib/merit/controller_extensions.rb
  25. +8 −8 lib/{ → merit}/generators/active_record/install_generator.rb
  26. +4 −4 lib/{ → merit}/generators/active_record/merit_generator.rb
  27. +5 −5 lib/{ → merit}/generators/active_record/remove_generator.rb
  28. 0 ...erit_fields_to_model.rb → merit/generators/active_record/templates/add_merit_fields_to_model.erb}
  29. 0 ...ates/create_badges_sashes.rb → merit/generators/active_record/templates/create_badges_sashes.erb}
  30. +2 −0 ...ates/create_merit_actions.rb → merit/generators/active_record/templates/create_merit_actions.erb}
  31. 0 ...merit_activity_logs.rb → merit/generators/active_record/templates/create_merit_activity_logs.erb}
  32. 0 ...e_record/templates/create_sashes.rb → merit/generators/active_record/templates/create_sashes.erb}
  33. +1 −1 ...ate_scores_and_points.rb → merit/generators/active_record/templates/create_scores_and_points.erb}
  34. 0 ...elds_from_model.rb → merit/generators/active_record/templates/remove_merit_fields_from_model.erb}
  35. 0 ...plates/remove_merit_tables.rb → merit/generators/active_record/templates/remove_merit_tables.erb}
  36. +21 −0 lib/merit/generators/install_generator.rb
  37. +7 −2 lib/{generators/merit → merit/generators}/merit_generator.rb
  38. +7 −2 lib/{generators/merit → merit/generators}/remove_generator.rb
  39. +13 −14 lib/{generators/merit/templates/merit.rb → merit/generators/templates/merit.erb}
  40. 0 ...nerators/merit/templates/merit_badge_rules.rb → merit/generators/templates/merit_badge_rules.erb}
  41. 0 ...nerators/merit/templates/merit_point_rules.rb → merit/generators/templates/merit_point_rules.erb}
  42. 0 ...generators/merit/templates/merit_rank_rules.rb → merit/generators/templates/merit_rank_rules.erb}
  43. +6 −5 lib/merit/judge.rb
  44. +12 −10 app/models/merit/action.rb → lib/merit/models/action_concern.rb
  45. +11 −0 lib/merit/models/active_record/action.rb
  46. +4 −6 lib/merit/models/active_record/{merit → }/activity_log.rb
  47. +4 −4 lib/merit/models/active_record/{merit → }/badges_sash.rb
  48. +0 −12 lib/merit/models/active_record/merit/action.rb
  49. +5 −2 lib/merit/models/active_record/{merit → }/sash.rb
  50. +4 −1 lib/merit/models/active_record/{merit → }/score.rb
  51. +13 −0 lib/merit/models/badges_sash_concern.rb
  52. +1 −1 lib/merit/models/base/badges_sash.rb
  53. +1 −1 lib/merit/models/base/sash.rb
  54. +0 −18 lib/merit/models/mongoid/merit/action.rb
  55. +0 −11 lib/merit/models/mongoid/merit/activity_log.rb
  56. +0 −22 lib/merit/models/mongoid/merit/badges_sash.rb
  57. +0 −30 lib/merit/models/mongoid/merit/sash.rb
  58. +0 −45 lib/merit/models/mongoid/merit/score.rb
  59. +53 −0 lib/merit/models/sash_concern.rb
  60. 0 lib/merit/{rules_points_methods.rb → point_rules_methods.rb}
  61. +3 −18 lib/merit/{rules_rank_methods.rb → rank_rules_methods.rb}
  62. +8 −5 merit.gemspec
  63. +1 −1 test/dummy/app/controllers/comments_controller.rb
  64. +1 −1 test/dummy/app/controllers/registrations_controller.rb
  65. +1 −12 test/dummy/app/models/address.rb
  66. +3 −25 test/dummy/app/models/comment.rb
  67. +1 −18 test/dummy/app/models/user.rb
  68. +2 −11 test/dummy/config/application.rb
  69. +28 −0 test/dummy/config/application_api_only.rb
  70. +7 −0 test/dummy/config/environment_api_only.rb
  71. +39 −37 test/dummy/config/initializers/merit.rb
  72. +3 −0 test/dummy/config/initializers/new_framework_defaults.rb
  73. +2 −0 test/dummy/db/migrate/20130329224406_create_merit_actions.rb
  74. +0 −8 test/dummy/db/migrate/20140906225844_create_players.rb
  75. +61 −65 test/dummy/db/schema.rb
  76. +0 −2 test/dummy/public/javascripts/application.js
  77. +0 −965 test/dummy/public/javascripts/controls.js
  78. +0 −974 test/dummy/public/javascripts/dragdrop.js
  79. +0 −1,123 test/dummy/public/javascripts/effects.js
  80. +0 −6,001 test/dummy/public/javascripts/prototype.js
  81. +0 −191 test/dummy/public/javascripts/rails.js
  82. +4 −3 test/integration/navigation_test.rb
  83. +0 −2 test/orm/active_record.rb
  84. +0 −6 test/orm/mongoid.rb
  85. +0 −11 test/orm_models/active_record.rb
  86. +0 −15 test/orm_models/mongoid.rb
  87. +11 −12 test/test_helper.rb
  88. +1 −0 test/unit/action_test.rb
  89. +8 −26 test/unit/base_target_finder_test.rb
  90. +13 −17 test/unit/merit_unit_test.rb
  91. +15 −8 test/unit/rule_unit_test.rb
  92. +9 −6 test/unit/rules_matcher_test.rb
  93. +5 −5 test/unit/sash_finder_test.rb
  94. +16 −0 test/unit/sash_test.rb
  95. +1 −1 test/unit/score_test.rb
  96. +13 −13 test/unit/target_finder_test.rb
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Tests

on:
pull_request:
branches:
- '*'
push:
branches:
- master

jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
ruby: ['3.1', '3.2', '3.3']
gemfile:
- rails_6_1
- rails_7
- rails_7_1

env:
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
BUNDLE_PATH_RELATIVE_TO_CWD: true

steps:
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler: default
bundler-cache: true
rubygems: latest

- name: Run tests
env:
RAILS_ENV: test
run: |
bundle exec rake setup
bundle exec rake test
11 changes: 0 additions & 11 deletions .travis.yml

This file was deleted.

11 changes: 11 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
appraise 'rails_6_1' do
gem 'rails', '~> 6.1'
end

appraise 'rails_7' do
gem 'rails', '~> 7.0'
end

appraise 'rails_7_1' do
gem 'rails', '~> 7.1'
end
26 changes: 7 additions & 19 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -2,27 +2,15 @@ source 'https://rubygems.org'

gemspec

version = ENV['RAILS_VERSION'] || '5.0.3'
gem 'rails', version
# Ruby 3.4?
# gem 'base64'
# gem 'mutex_m'
# gem 'observer'

case ENV['ORM']
when 'active_record'
gem 'activerecord'
when 'mongoid'
gem 'mongoid'
end
gem "rails"

group :development, :test do
gem 'activerecord-jdbcsqlite3-adapter', :platforms => [:jruby]
gem 'sqlite3', '~> 1.3.8', :platforms => [:ruby, :mswin, :mingw]
end

platforms :rbx do
gem 'rubysl', '~> 2.0'
gem 'psych'
gem 'racc'
gem 'minitest', '~> 5.10', '!= 5.10.2'
gem 'rubinius-developer_tools'
gem 'sqlite3', '~> 1.4'
end

gem 'coveralls', require: false
gem 'coveralls', '~> 0.8.23', require: false
45 changes: 45 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,51 @@

User-visible changes worth mentioning.

## 5.0.0 (unreleased)

- Drop end-of-life'd versions of rails: 5.2 and 6.0, and ruby 3.0
- Test with current versions of Rails: 6.1, 7.0, 7.1
- Convert project to GitHub Actions
- Mark 3 tests as pending to the open bug on deleted models

## 4.0.3

- Add webrick as a development dependency
- [#363] Fix: `warning: already initialized constant Merit::*` messages
- [#357] Fix `merit_actions` migration template

## 4.0.2

- [#355, #356] Add index on merit_actions.processed column
- [#354] Fix Rails autoloader deprecation warnings
Requires wrapping `Merit::Badge.create` with `Rails.application.reloader.to_prepare`
- Test with Ruby 3 and Rails 6.1 (excludes Rails 5.2 with Ruby 3, that errors out)
- [#288] Don’t send “removed badge” notifications when user doesn’t have the badge

## 4.0.1

- [#351] Fix bug on generating migrations

## 4.0.0

- Stop testing on Rails 5.1
- Drop support for mongoid
- Drop v2 upgrade generators
- Enable Zeitwerk gem mode (and renames internal merit constants)

## 3.0.3

- Test against Ruby 2.6 and Rails 6
- Use `find_each` in favor of `map` in `Merit::Action.check_unprocessed`
- Allow finding badges defined with symbol names
- Remove `Badge#last_granted` method (deprecated in merit <2.0)

## 3.0.2

- [#287] Make Sash an optional dependency, fixing issues in Rails 5.1.
- [#297] Initialize merit once both for API or non-API apps
- Updates dependencies

## 3.0.1

- [#282] Run action controller load hook only once
40 changes: 29 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@
Merit adds reputation behavior to Rails apps in the form of Badges, Points,
and Rankings.

[![Build Status](https://travis-ci.org/merit-gem/merit.svg?branch=master)](http://travis-ci.org/merit-gem/merit)
[![Coverage Status](https://coveralls.io/repos/github/merit-gem/merit/badge.svg?branch=master)](https://coveralls.io/github/merit-gem/merit?branch=master)
[![Code Climate](https://codeclimate.com/github/tute/merit/badges/gpa.svg)](https://codeclimate.com/github/tute/merit)

@@ -38,8 +37,7 @@ and Rankings.
2. Run `rails g merit:install`. This creates several migrations.
3. Run `rails g merit MODEL_NAME` (e.g. `user`). This creates a migration and adds `has_merit` to MODEL_NAME.
4. Run `rake db:migrate`
5. Define badges in `config/initializers/merit.rb`. You can also define ORM:
`:active_record` (default) or `:mongoid`.
5. Define badges in `config/initializers/merit.rb`
6. Configure reputation rules for your application in `app/models/merit/*`


@@ -59,12 +57,16 @@ Create badges in `config/initializers/merit.rb`
### Example

```ruby
Merit::Badge.create!(
id: 1,
name: "year-member",
description: "Active member for a year",
custom_fields: { difficulty: :silver }
)
# config/initializers/merit.rb

Rails.application.reloader.to_prepare do
Merit::Badge.create!(
id: 1,
name: "year-member",
description: "Active member for a year",
custom_fields: { difficulty: :silver }
)
end
```

## Defining Rules
@@ -114,6 +116,19 @@ grant_on ['users#create', 'users#update'], badge: 'autobiographer', temporary: t
end
```

If your controller is under a namespace other than root (example:
`Api::ModelController`) then for merit to find your object automatically you
must specify the model class and not forget that your action is of the form
`namespace/models#action`.

See an example of a `Post` model that belongs to user:

```ruby
grant_on 'api/posts#create', badge: 'first-post', model_name: 'Post', to: :user do |post|
post.user.posts.count >= 1
end
```

## Other Actions

```ruby
@@ -293,8 +308,8 @@ warning, with a comment to check the configuration for the rule.

# Getting Notifications

You can get observers notified any time merit changes reputation in your
application.
You can get observers notified any time merit automatically changes reputation
in your application.

It needs to implement the `update` method, which receives as parameter the
following hash:
@@ -325,6 +340,9 @@ end
config.add_observer 'ReputationChangeObserver'
```

**NOTE:** Observers won’t get notified if you grant reputation with
direct calls to `add_badge` or `add_point`.

# I18n

Merit uses default messages with I18n for notify alerts. To customize your app, you can set up your locale file:
19 changes: 16 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: UTF-8
begin
require 'bundler/setup'
rescue LoadError
@@ -7,8 +6,14 @@ end

require 'rake/testtask'

desc 'Default: run tests for all ORMs.'
task default: :test
desc 'Default: run tests for all rails\' versions.'
if !ENV["APPRAISAL_INITIALIZED"]
task default: [:setup, :appraisal]
end

task :setup do
system "cd test/dummy && rake db:migrate && rake db:test:prepare"
end

Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
@@ -17,6 +22,14 @@ Rake::TestTask.new(:test) do |t|
t.verbose = true
end

Rake::TestTask.new(:api_test) do |t|
t.libs << 'lib'
t.libs << 'test'
t.test_files = FileList['test/**/*_test.rb'].exclude(/navigation_test.rb/)
t.verbose = true
t.options = '-- -api-only'
end

begin
require 'rdoc/task'
Rake::RDocTask.new(:rdoc) do |rdoc|
Loading