merit-gem / merit

Reputation engine for Rails apps
Other
1.53k stars 198 forks source link

Generator inserts "has_merit"-macro twice in User model #165

Closed mayinx closed 10 years ago

mayinx commented 10 years ago

Just a minor issue (I'm using rails 3.2.9,, ruby 1.9.2) When running

rails g merit user     

it inserts the has_merit macro twice: Correctly inside the user model at the top - but also AFTER the User model :

class User < ActiveRecord::Base
  has_merit
  # ...
end
  has_merit
tute commented 10 years ago

I can't replicate it. Can you please paste exactly the contents of your user.rb file?

mayinx commented 10 years ago

Sorry - I probably should have mentioned that I subclass User in the same file (STI) - perhaps that's the reason - here's my chaotic user.rb (the second Macro was inserted between the two models):

# -*- encoding : utf-8 -*-
class User < ActiveRecord::Base

  # merit reputation gem
  has_merit

  include Shared::UserStamping
  include User::Validations
  include User::Authentication
  include User::ArchivableAndActivatable
  include User::RolesForAuthorization

  accepts_nested_attributes_for :profile

  mount_uploader :avatar, AvatarUploader

  acts_as_tagger

  normalize_attributes :first_name, :last_name, :full_name, :login, :password, :password_confirmation, :old_password

  belongs_to :domain
  has_one :profile, :class_name => "UserProfile", :dependent => :destroy
  has_one :participation_statistic, :class_name => "UserParticipationStatistic", :dependent => :destroy

  has_many :posts, :order => 'created_at DESC'
  has_many :pages, :order => 'title ASC'
  has_many :page_versions,
           :class_name => "PageVersion",
           :foreign_key => "updater_id"

   has_many :edited_wiki_pages,
           :through => :page_versions,
           :class_name => "Page",
           :source => :page,
           :uniq => true,
           :order => 'updated_at DESC'

    has_many :recent_events,  :as => :actor, :class_name => "TimelineEvent",
           :order => "timeline_events.created_at DESC"

  cattr_reader :per_page
  @@per_page = 6

  scope :domain, lambda  { |domain|
    where("users.domain_id = ?", domain.id)
  }
  def i18n_key
    "#{self.class.to_s}_#{self.domain.i18n_key}".downcase
  end

  def to_label
    "#{self.first_name} #{self.last_name}"
  end
end
  has_merit 

class Student < User
  before_validation :randomize_password, :on => :create
  before_create :auto_activate
  mount_uploader :avatar, AvatarUploader

  def i18n_key
    "#{self.class.to_s}_#{self.domain.i18n_key}".downcase
  end

  protected
    def randomize_password
      unless self.password.present?
        self.password = SecureRandom.hex(10)
      end
    end

    def auto_activate
      self.confirmed = true
      activate
    end

  private
    def require_password?
      super || validate_password
    end

    def require_email?
      false
    end
end  

I got another problem - I don't know, if I'm doing something wrong here (I'm obviously new to Merit), so I post it here - let me know, if you want me to open another issue for it - it seems to be a namespace / uninitialized constant issue?:

I created a test-badge in config/initializers/merit.rb:

badge_id = 0

Merit::Badge.create!(
  id: (badge_id = badge_id+1),
  name: "Yearling",
  description: "Active member for a year",
  custom_fields: { difficulty: :silver }
)

When I run Badge.find in the Rails console I get the following NameError:

1.9.2-p180 :004 >   Badge.find(1)
NameError: uninitialized constant Badge
    from (irb):4
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.2.9/lib/rails/commands/console.rb:47:in `start'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.2.9/lib/rails/commands/console.rb:8:in `start'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.2.9/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

It works fine, if I use the Merrit-prefix:

1.9.2-p180 :005 > Merit::Badge.find(1)
 => #<Merit::Badge id: 1, name: "Yearling", level: nil, description: "Active member for a year", custom_fields: {:difficulty=>:silver}> 

But if I try to add this badge to a user, I get another uninitialized constant error:

1.9.2-p180 :006 > user.add_badge(1)
   (0.6ms)  BEGIN 
  SQL (2.8ms)  INSERT INTO "sashes" ("created_at", "updated_at") VALUES ($1, $2) RETURNING "id"   [["created_at", Tue, 29 Apr 2014 01:07:56 CEST +02:00], ["updated_at", Tue, 29 Apr 2014 01:07:56 CEST +02:00]]
  SQL (1.4ms)  INSERT INTO "merit_scores" ("category", "sash_id") VALUES ($1, $2) RETURNING "id"   [["category", "default"], ["sash_id", nil]]
   (1.0ms)  UPDATE "merit_scores" SET "sash_id" = 9 WHERE "merit_scores"."id" = 9
   (0.3ms)  ROLLBACK  
NameError: uninitialized constant Sash
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.2.9/lib/active_support/inflector/methods.rb:230:in `block in constantize'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.2.9/lib/active_support/inflector/methods.rb:229:in `each'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.2.9/lib/active_support/inflector/methods.rb:229:in `constantize'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.2.9/lib/active_support/core_ext/string/inflections.rb:54:in `constantize'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/active_scaffold-3.2.17/lib/active_scaffold/extensions/reverse_associations.rb:34:in `block in autodetect_inverse'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/active_scaffold-3.2.17/lib/active_scaffold/extensions/reverse_associations.rb:26:in `each'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/active_scaffold-3.2.17/lib/active_scaffold/extensions/reverse_associations.rb:26:in `autodetect_inverse'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/active_scaffold-3.2.17/lib/active_scaffold/extensions/reverse_associations.rb:15:in `inverse_of_with_autodetect'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.2.9/lib/active_record/associations/association.rb:212:in `inverse_reflection_for'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.2.9/lib/active_record/associations/association.rb:217:in `invertible_for?'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/bullet-4.7.1/lib/bullet/active_record3x.rb:86:in `set_inverse_instance'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.2.9/lib/active_record/associations/collection_association.rb:353:in `add_to_target'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.2.9/lib/active_record/associations/collection_association.rb:495:in `block in concat_records'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.2.9/lib/active_record/associations/collection_association.rb:493:in `each'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.2.9/lib/active_record/associations/collection_association.rb:493:in `concat_records'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.2.9/lib/active_record/associations/collection_association.rb:134:in `block in concat'
... 24 levels...
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.2.9/lib/active_record/transactions.rb:208:in `transaction'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.2.9/lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.2.9/lib/active_record/transactions.rb:259:in `block in save'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.2.9/lib/active_record/transactions.rb:270:in `rollback_active_record_state!'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.2.9/lib/active_record/transactions.rb:258:in `save'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/active_scaffold-3.2.17/lib/active_scaffold/extensions/unsaved_record.rb:15:in `save_with_unsaved_flag'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.2.9/lib/active_record/persistence.rb:45:in `create'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/merit-2.1.1/lib/merit/model_additions.rb:52:in `block in _merit_sash_initializer'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/merit-2.1.1/lib/merit/model_additions.rb:23:in `add_badge'
    from (irb):6
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.2.9/lib/rails/commands/console.rb:47:in `start'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.2.9/lib/rails/commands/console.rb:8:in `start'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.2.9/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'

Similar happens when I run user.badges:

    from script/rails:6:in `<main>'1.9.2-p180 :007 > user.badges
   (0.5ms)  BEGIN  
  SQL (1.3ms)  INSERT INTO "sashes" ("created_at", "updated_at") VALUES ($1, $2) RETURNING "id"    [["created_at", Tue, 29 Apr 2014 01:08:12 CEST +02:00], ["updated_at", Tue, 29 Apr 2014 01:08:12 CEST +02:00]]
  SQL (0.7ms)  INSERT INTO "merit_scores" ("category", "sash_id") VALUES ($1, $2) RETURNING "id"    [["category", "default"], ["sash_id", nil]]
   (0.8ms)  UPDATE "merit_scores" SET "sash_id" = 10 WHERE "merit_scores"."id" = 10
   (0.5ms)  ROLLBACK  
NameError: uninitialized constant Sash
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.2.9/lib/active_support/inflector/methods.rb:230:in `block in constantize'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.2.9/lib/active_support/inflector/methods.rb:229:in `each'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.2.9/lib/active_support/inflector/methods.rb:229:in `constantize'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.2.9/lib/active_support/core_ext/string/inflections.rb:54:in `constantize'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/active_scaffold-3.2.17/lib/active_scaffold/extensions/reverse_associations.rb:34:in `block in autodetect_inverse'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/active_scaffold-3.2.17/lib/active_scaffold/extensions/reverse_associations.rb:26:in `each'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/active_scaffold-3.2.17/lib/active_scaffold/extensions/reverse_associations.rb:26:in `autodetect_inverse'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/active_scaffold-3.2.17/lib/active_scaffold/extensions/reverse_associations.rb:15:in `inverse_of_with_autodetect'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.2.9/lib/active_record/associations/association.rb:212:in `inverse_reflection_for'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.2.9/lib/active_record/associations/association.rb:217:in `invertible_for?'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/bullet-4.7.1/lib/bullet/active_record3x.rb:86:in `set_inverse_instance'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.2.9/lib/active_record/associations/collection_association.rb:353:in `add_to_target'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.2.9/lib/active_record/associations/collection_association.rb:495:in `block in concat_records'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.2.9/lib/active_record/associations/collection_association.rb:493:in `each'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.2.9/lib/active_record/associations/collection_association.rb:493:in `concat_records'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.2.9/lib/active_record/associations/collection_association.rb:134:in `block in concat'
... 24 levels...
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.2.9/lib/active_record/transactions.rb:208:in `transaction'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.2.9/lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.2.9/lib/active_record/transactions.rb:259:in `block in save'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.2.9/lib/active_record/transactions.rb:270:in `rollback_active_record_state!'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.2.9/lib/active_record/transactions.rb:258:in `save'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/active_scaffold-3.2.17/lib/active_scaffold/extensions/unsaved_record.rb:15:in `save_with_unsaved_flag'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.2.9/lib/active_record/persistence.rb:45:in `create'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/merit-2.1.1/lib/merit/model_additions.rb:52:in `block in _merit_sash_initializer'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/merit-2.1.1/lib/merit/model_additions.rb:23:in `badges'
    from (irb):7
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.2.9/lib/rails/commands/console.rb:47:in `start'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.2.9/lib/rails/commands/console.rb:8:in `start'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.2.9/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'

Again - a Merit:: prefix seems to be expected:

1.9.2-p180 :010 > Merit::Sash
 => Merit::Sash(id: integer, created_at: datetime, updated_at: datetime) 

Without prefix:

1.9.2-p180 :009 >   Sash
NameError: uninitialized constant Sash
    from (irb):9
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.2.9/lib/rails/commands/console.rb:47:in `start'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.2.9/lib/rails/commands/console.rb:8:in `start'
    from /home/mayinx/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.2.9/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

Any ideas?

Cheers

tute commented 10 years ago

Regarding the repeated has_merit, I have no idea why it happens, this is coming from Thor's inject_into_class so if it's a bug it belongs in there.

Regarding the Merit:: prefix, that's correct, it's always needed. Are you referencing Sash anywhere in your application? Can you post your schema.rb and Gemfile.lock?

mayinx commented 10 years ago

No, I don't reference Sash anywhere in my app - I checked that already...

Here's my Gemfile:

source 'http://rubygems.org'

## ruby
ruby "1.9.2"

## Rails / Rails-related Gems ##
#  TODO: Upgrade to 3.2.11 asap due to multiple security vulnerabilities
gem 'rails', '3.2.9'

gem 'rails_autolink', '1.1.4' # The auto_link helper has been moved out into a gem since rails 3.1 (TODO: upgrade to 1.1.5 - new version 1.1.5 requries rubyv1.9.3)
# to enable old-style helpers for error_message_for, error_message_on,
# form, input, f.error_messages and f.error_messages_on
gem "dynamic_form"

## DB-related Gems ##
gem "pg" #Ruby interface to the PostgreSQL RDBMS [http://www.postgresql.org/]

## Server ###

group :development, :test do
  gem "thin" # use thin in development & test-env
end

# use unicorn in production & staging
group :production, :staging do
  gem 'unicorn' # for concurrent request processing on heroku

  # Rails 12factor
  gem 'rails_12factor'
end

# new relic (must be outside any groups! + "preload_app true" directive must be set in config/unicorn.rb)
gem 'newrelic_rpm'

# HAML
gem "haml-rails"

gem "active_scaffold", "3.2.17" # Admin Interface # active_scaffold-3.2.17
#gem "active_scaffold" #, "3.2.17" # Admin Interface
gem "authlogic" # authentication 
gem "will_paginate" # pagination

## Cells ##
gem "cells" #, "3.6.0" # view components framework for Rails
gem "cells-filters" # Before and after filters for your cells

## Decorators/View-Models ##
gem 'draper'

## FILE-HANDLING ##
gem "carrierwave" # file upload
gem "fog", "~> 1.3.1" # Ruby cloud services library (used by carrierwave & asset_sync - encapsulates access to amazon s3)
gem "rmagick", "2.13.1", :require => 'RMagick' # Interface to the ImageMagick and GraphicsMagick image processing libraries
# gem "rmagick", "2.13.1" # Interface to the ImageMagick and GraphicsMagick image processing libraries
# Process your uploads in the background by uploading directly to S3 (works with background processors such as DelayedJob or Resque)
gem 'carrierwave_backgrounder'

# Direct Upload to Amazon S3 With CORS - Easily generate a form that allows you to upload directly to Amazon S3. Multi file uploading supported by jquery-fileupload.
gem 's3_direct_upload' # direct upload form helper and assets

## MODEL RELATED GEMS ##
gem 'attribute_normalizer' # normalize attributes cleanly with code blocks and predefined normalizers
gem "acts-as-taggable-on"# custom tagging along dynamic contexts
gem "acts_as_commentable"# comments to be added to multiple and different models.
gem 'acts_as_versioned', :git => 'https://github.com/jwhitehorn/acts_as_versioned.git' # ActiveRecord plugin for versioning your models
gem "default_value_for" # default values for ar-models
# Since there is no .gemspec for this, you must specify ‘0.0.0’ as version in your Gemfile to make it install properly:
gem 'simple-private-messages', '0.0.0', :git => 'git://github.com/jongilbraith/simple-private-messages.git'
gem "timeline_fu" # Easily build timelines, much like GitHub’s news feed.
# Reputation system Rails engine.
gem 'merit'

## Search ##
gem "ransack", "~> 1.0.0" # Object-based searching / create complex search forms with ease

## Textile ##
gem "RedCloth", :require => 'redcloth' # Ruby library for converting Textile into HTML
gem "textile_editor_helper", '>=0.0.30' # Textile toolbar above textareas

gem 'htmlentities' # needed by textile editor helper for the preview feature (as well as RedCloth of course)

## Gemified JS-/CSS-Libs ##
gem "jquery-rails", "~> 2.3.0" 
gem 'jquery-ui-rails' # jQuery UI's JavaScript, CSS, and image files packaged for the Rails 3.1+ asset pipeline
gem 'facebox-rails' # gemified version of facebox for Rails 3.1 ...
gem "gritter", "1.0.2"  # add Growl-like notifications  
gem 'css3buttons', :git => 'git://github.com/thetron/css3buttons_rails_helpers.git' 

## worker- / backgrounbd-job-related gems

# Delayed Job uses your database as a queue to process background jobs.
gem "delayed_job_active_record", "0.4.3" # this version works
gem "workless", "~> 1.1.3"
gem "delayed_job_web" # Resque like web interface for delayed job

## Asset-related gems ##
group :assets do
  gem 'sass-rails' #, " ~> 3.2.3" # Sass adapter for the Rails asset pipeline.
  gem 'coffee-rails' #, " ~> 3.2.1" # Coffee Script adapter for the Rails asset pipeline.
  gem 'uglifier' # Ruby wrapper for UglifyJS JavaScript compressor

  # jQuery File Upload integrated for Rails 3.1 Asset Pipeline
  gem 'jquery-fileupload-rails'

  # Synchronises Assets between Rails and S3 to speed up asset delivery 
  gem "asset_sync"

  # Speeds up your Rails 3 assets:precompile by only recompiling changed files, and only compiling once to generate all assets
  gem 'turbo-sprockets-rails3'
end

## Configuration / Environments etc. ###
gem "figaro" # Simple Rails app configuration

## CLI-related Gems ##
gem "colorize" # colorized puts - finally - need this in each environment !

## Development-related Gems ##
# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
group :development do
  gem 'rails-dev-tweaks', '~> 0.6.1'  # A collection of tweaks to improve your Rails (3.1+) development experience.
  gem "magic_encoding", "~> 0.0.2" # Easily add magic comments for encoding on multiple ruby source files
  # Gem that shows footnotes on every page with information about the application and links back to the editor
  gem 'rails-footnotes', '>= 3.7.5.rc4'
  # marginalia # see: https://github.com/37signals/marginalia
  gem 'marginalia'
  gem "hirb"
  gem "rails_best_practices"
  gem "mailcatcher" # Catches mail and serves it through a dream
  gem 'quiet_assets' 
  gem "better_errors" # Better error page for Rails and other Rack apps
  gem "binding_of_caller" 

  # PROFILING / PERFORMANCE
  gem 'bullet'

  # Chrome extension for Rails development  that will end your tailing of development.log.
  gem 'meta_request', '0.2.1'

  # Visit /rails/routes in your app and you'll see your routes. It's that simple.
  # TODO: can be removed in rails 4: The core functionality of Sextant is now merged into
  # Rails 4.0 under rails/info/routes
  gem 'sextant'

  # package of rake tasks that scan your application models and displays a list of columns that
  # probably should be indexed. Also, it can generate .sql migration scripts
  gem 'lol_dba' # (successor of rails_indexes for rails 3 / 4)

end

## Testing-related Gems ##
group :test do
  gem 'sqlite3-ruby', :require => 'sqlite3'
  #gem "factory_girl_rails"#, "1.0"
  gem "forgery" # Easy and customizable generation of forged data

  gem 'capybara', '1.1.2' # (auto-required by cucumber rails (see below) -but to make sure cucumber-.rails doesn't require capybarsa 2.0 (which requires Ruby 1.9.3) we install the gem explicitly

  gem 'cucumber-rails', "~> 1.4.0", :require => false#, '1.2.1'
  gem 'selenium-webdriver', '2.41.0'
  gem 'rspec-rails', "~> 2.11.4" #, '2.7.0'
  gem 'database_cleaner' #, '0.7.0'
  gem 'factory_girl'
  gem 'capybara-accessible' # Automated accessibility testing in RSpec and Rails
end

And here my Gemfile.lock:

GIT
  remote: git://github.com/jongilbraith/simple-private-messages.git
  revision: 7ba7d3c9f7670ef3bddfc90390a49556a94f7013
  specs:
    simple-private-messages (0.0.0)

GIT
  remote: git://github.com/thetron/css3buttons_rails_helpers.git
  revision: 78f8c8cb4ac92f462fc145a000220e6bb0d0878a
  specs:
    css3buttons (1.0.1)
      actionpack (>= 3.0.0)

GIT
  remote: https://github.com/jwhitehorn/acts_as_versioned.git
  revision: 44dfe632ba8c97c786cbc172a2da18a41b17f668
  specs:
    acts_as_versioned (3.2.1)
      activerecord

GEM
  remote: http://rubygems.org/
  specs:
    RedCloth (4.2.9)
    actionmailer (3.2.9)
      actionpack (= 3.2.9)
      mail (~> 2.4.4)
    actionpack (3.2.9)
      activemodel (= 3.2.9)
      activesupport (= 3.2.9)
      builder (~> 3.0.0)
      erubis (~> 2.7.0)
      journey (~> 1.0.4)
      rack (~> 1.4.0)
      rack-cache (~> 1.2)
      rack-test (~> 0.6.1)
      sprockets (~> 2.2.1)
    active_scaffold (3.2.17)
      rails (>= 3.1.3)
    activemodel (3.2.9)
      activesupport (= 3.2.9)
      builder (~> 3.0.0)
    activerecord (3.2.9)
      activemodel (= 3.2.9)
      activesupport (= 3.2.9)
      arel (~> 3.0.2)
      tzinfo (~> 0.3.29)
    activeresource (3.2.9)
      activemodel (= 3.2.9)
      activesupport (= 3.2.9)
    activesupport (3.2.9)
      i18n (~> 0.6)
      multi_json (~> 1.0)
    acts-as-taggable-on (2.4.1)
      rails (>= 3, < 5)
    acts_as_commentable (4.0.1)
    addressable (2.3.5)
    ambry (0.3.1)
    arel (3.0.2)
    asset_sync (0.5.4)
      activemodel
      fog
    attribute_normalizer (1.1.0)
    authlogic (3.3.0)
      activerecord (>= 3.2)
      activesupport (>= 3.2)
    awesome_print (1.2.0)
    better_errors (1.0.1)
      coderay (>= 1.0.0)
      erubis (>= 2.6.6)
    binding_of_caller (0.7.2)
      debug_inspector (>= 0.0.1)
    builder (3.0.4)
    bullet (4.7.1)
      activesupport
      uniform_notifier (>= 1.4.0)
    capybara (1.1.2)
      mime-types (>= 1.16)
      nokogiri (>= 1.3.3)
      rack (>= 1.0.0)
      rack-test (>= 0.5.4)
      selenium-webdriver (~> 2.0)
      xpath (~> 0.1.4)
    capybara-accessible (0.1.8)
      capybara
      selenium-webdriver
    carrierwave (0.9.0)
      activemodel (>= 3.2.0)
      activesupport (>= 3.2.0)
      json (>= 1.7)
    carrierwave_backgrounder (0.3.0)
      carrierwave (~> 0.5)
    cells (3.9.0)
      actionpack (>= 3.0)
      railties (>= 3.0)
    cells-filters (0.0.1)
      cells
      hooks
    childprocess (0.5.2)
      ffi (~> 1.0, >= 1.0.11)
    climate_control (0.0.3)
      activesupport (>= 3.0)
    cocaine (0.5.3)
      climate_control (>= 0.0.3, < 1.0)
    code_analyzer (0.4.3)
      sexp_processor
    coderay (1.1.0)
    coffee-rails (3.2.2)
      coffee-script (>= 2.2.0)
      railties (~> 3.2.0)
    coffee-script (2.2.0)
      coffee-script-source
      execjs
    coffee-script-source (1.6.3)
    colored (1.2)
    colorize (0.6.0)
    cucumber (1.3.8)
      builder (>= 2.1.2)
      diff-lcs (>= 1.1.3)
      gherkin (~> 2.12.1)
      multi_json (>= 1.7.5, < 2.0)
      multi_test (>= 0.0.2)
    cucumber-rails (1.4.0)
      capybara (>= 1.1.2)
      cucumber (>= 1.2.0)
      nokogiri (>= 1.5.0)
      rails (>= 3.0.0)
    daemons (1.1.9)
    database_cleaner (1.2.0)
    debug_inspector (0.0.2)
    default_value_for (2.0.3)
    delayed_job (3.0.5)
      activesupport (~> 3.0)
    delayed_job_active_record (0.4.3)
      activerecord (>= 2.1.0, < 4)
      delayed_job (~> 3.0)
    delayed_job_web (1.2.0)
      activerecord (> 3.0.0)
      delayed_job (> 2.0.3)
      haml (>= 3.1.3)
      rdoc
      sinatra (>= 0.9.2)
    diff-lcs (1.1.3)
    draper (1.3.0)
      actionpack (>= 3.0)
      activemodel (>= 3.0)
      activesupport (>= 3.0)
      request_store (~> 1.0.3)
    dynamic_form (1.1.4)
    erubis (2.7.0)
    eventmachine (1.0.3)
    excon (0.13.4)
    execjs (2.0.2)
    facebox-rails (0.2.0)
      railties (>= 3.0, < 5.0)
      thor (>= 0.14, < 2.0)
    factory_girl (4.3.0)
      activesupport (>= 3.0.0)
    fattr (2.2.1)
    ffi (1.9.3)
    figaro (0.7.0)
      bundler (~> 1.0)
      rails (>= 3, < 5)
    fog (1.3.1)
      builder
      excon (~> 0.13.0)
      formatador (~> 0.2.0)
      mime-types
      multi_json (~> 1.0)
      net-scp (~> 1.0.4)
      net-ssh (>= 2.1.3)
      nokogiri (~> 1.5.0)
      ruby-hmac
    forgery (0.5.0)
    formatador (0.2.4)
    gherkin (2.12.2)
      multi_json (~> 1.3)
    gritter (1.0.2)
    haml (4.0.3)
      tilt
    haml-rails (0.4)
      actionpack (>= 3.1, < 4.1)
      activesupport (>= 3.1, < 4.1)
      haml (>= 3.1, < 4.1)
      railties (>= 3.1, < 4.1)
    heroku (2.26.3)
      heroku-api (~> 0.2.1)
      launchy (>= 0.3.2)
      netrc (~> 0.7.2)
      rest-client (~> 1.6.1)
      rubyzip
    heroku-api (0.2.1)
      excon (~> 0.13.3)
    hike (1.2.3)
    hirb (0.7.1)
    hooks (0.3.1)
    htmlentities (4.3.1)
    i18n (0.6.5)
    journey (1.0.4)
    jquery-fileupload-rails (0.4.1)
      actionpack (>= 3.1)
      railties (>= 3.1)
    jquery-rails (2.3.0)
      railties (>= 3.0, < 5.0)
      thor (>= 0.14, < 2.0)
    jquery-ui-rails (4.1.0)
      railties (>= 3.1.0)
    json (1.8.1)
    kgio (2.8.1)
    launchy (2.3.0)
      addressable (~> 2.3)
    lol_dba (1.6.0)
      actionpack (>= 3.0)
      activerecord (>= 3.0)
      railties (>= 3.0)
    magic_encoding (0.0.2)
    mail (2.4.4)
      i18n (>= 0.4.0)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    mailcatcher (0.5.12)
      activesupport (~> 3.0)
      eventmachine (~> 1.0.0)
      haml (>= 3.1, < 5)
      mail (~> 2.3)
      sinatra (~> 1.2)
      skinny (~> 0.2.3)
      sqlite3 (~> 1.3)
      thin (~> 1.5.0)
    marginalia (1.1.3)
      actionpack (>= 2.3, < 3.3)
      activerecord (>= 2.3, < 3.3)
    merit (2.1.1)
      ambry (~> 0.3.0)
    meta_request (0.2.1)
      rack-contrib
      rails
    mime-types (1.25)
    multi_json (1.9.2)
    multi_test (0.0.2)
    net-scp (1.0.4)
      net-ssh (>= 1.99.1)
    net-ssh (2.7.0)
    netrc (0.7.7)
    newrelic_rpm (3.6.8.168)
    nokogiri (1.5.10)
    paperclip (3.5.2)
      activemodel (>= 3.0.0)
      activesupport (>= 3.0.0)
      cocaine (~> 0.5.3)
      mime-types
    pg (0.17.0)
    polyamorous (0.6.4)
      activerecord (>= 3.0)
    polyglot (0.3.3)
    quiet_assets (1.0.2)
      railties (>= 3.1, < 5.0)
    rack (1.4.5)
    rack-cache (1.2)
      rack (>= 0.4)
    rack-contrib (1.1.0)
      rack (>= 0.9.1)
    rack-protection (1.5.1)
      rack
    rack-ssl (1.3.3)
      rack
    rack-test (0.6.2)
      rack (>= 1.0)
    rails (3.2.9)
      actionmailer (= 3.2.9)
      actionpack (= 3.2.9)
      activerecord (= 3.2.9)
      activeresource (= 3.2.9)
      activesupport (= 3.2.9)
      bundler (~> 1.0)
      railties (= 3.2.9)
    rails-dev-tweaks (0.6.1)
      actionpack (~> 3.1)
      railties (~> 3.1)
    rails-footnotes (3.7.9)
      rails (>= 3.0.0)
    rails_12factor (0.0.2)
      rails_serve_static_assets
      rails_stdout_logging
    rails_autolink (1.1.4)
      rails (> 3.1)
    rails_best_practices (1.14.4)
      activesupport
      awesome_print
      code_analyzer (>= 0.4.3)
      colored
      erubis
      i18n
      require_all
      ruby-progressbar
    rails_serve_static_assets (0.0.1)
    rails_stdout_logging (0.0.3)
    railties (3.2.9)
      actionpack (= 3.2.9)
      activesupport (= 3.2.9)
      rack-ssl (~> 1.3.2)
      rake (>= 0.8.7)
      rdoc (~> 3.4)
      thor (>= 0.14.6, < 2.0)
    raindrops (0.12.0)
    rake (10.1.0)
    ransack (1.0.0)
      actionpack (>= 3.0)
      activerecord (>= 3.0)
      polyamorous (~> 0.6.0)
    rdoc (3.12.2)
      json (~> 1.4)
    request_store (1.0.5)
    require_all (1.3.2)
    rest-client (1.6.7)
      mime-types (>= 1.16)
    rmagick (2.13.1)
    rspec (2.11.0)
      rspec-core (~> 2.11.0)
      rspec-expectations (~> 2.11.0)
      rspec-mocks (~> 2.11.0)
    rspec-core (2.11.1)
    rspec-expectations (2.11.3)
      diff-lcs (~> 1.1.3)
    rspec-mocks (2.11.3)
    rspec-rails (2.11.4)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      railties (>= 3.0)
      rspec (~> 2.11.0)
    ruby-hmac (0.4.0)
    ruby-progressbar (1.2.0)
    rubyzip (1.1.3)
    rush (0.6.8)
      session
    s3_direct_upload (0.1.6)
      coffee-rails (>= 3.2.1)
      jquery-fileupload-rails (~> 0.4.1)
      rails (>= 3.2)
      sass-rails (>= 3.2.5)
    sass (3.2.12)
    sass-rails (3.2.6)
      railties (~> 3.2.0)
      sass (>= 3.1.10)
      tilt (~> 1.3)
    selenium-webdriver (2.41.0)
      childprocess (>= 0.5.0)
      multi_json (~> 1.0)
      rubyzip (~> 1.0)
      websocket (~> 1.0.4)
    session (3.1.0)
      fattr
    sexp_processor (4.4.0)
    sextant (0.2.4)
      rails (>= 3.2)
    sinatra (1.4.4)
      rack (~> 1.4)
      rack-protection (~> 1.4)
      tilt (~> 1.3, >= 1.3.4)
    skinny (0.2.3)
      eventmachine (~> 1.0.0)
      thin (~> 1.5.0)
    sprockets (2.2.2)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    sqlite3 (1.3.8)
    sqlite3-ruby (1.3.3)
      sqlite3 (>= 1.3.3)
    textile_editor_helper (0.0.31)
    thin (1.5.1)
      daemons (>= 1.0.9)
      eventmachine (>= 0.12.6)
      rack (>= 1.0.0)
    thor (0.18.1)
    tilt (1.4.1)
    timeline_fu (0.3.0)
    treetop (1.4.15)
      polyglot
      polyglot (>= 0.3.1)
    turbo-sprockets-rails3 (0.3.10)
      railties (> 3.2.8, < 4.0.0)
      sprockets (>= 2.0.0)
    tzinfo (0.3.38)
    uglifier (2.3.0)
      execjs (>= 0.3.0)
      json (>= 1.8.0)
    unicorn (4.7.0)
      kgio (~> 2.6)
      rack
      raindrops (~> 0.7)
    uniform_notifier (1.4.0)
    websocket (1.0.7)
    will_paginate (3.0.5)
    workless (1.1.3)
      delayed_job (>= 2.0.7)
      heroku-api
      rails
      rush
    xpath (0.1.4)
      nokogiri (~> 1.3)

PLATFORMS
  ruby

DEPENDENCIES
  RedCloth
  active_scaffold (= 3.2.17)
  acts-as-taggable-on
  acts_as_commentable
  acts_as_versioned!
  asset_sync
  attribute_normalizer
  authlogic
  better_errors
  binding_of_caller
  bullet
  capybara (= 1.1.2)
  capybara-accessible
  carrierwave
  carrierwave_backgrounder
  cells
  cells-filters
  coffee-rails
  colorize
  css3buttons!
  cucumber-rails (~> 1.4.0)
  database_cleaner
  default_value_for
  delayed_job_active_record (= 0.4.3)
  delayed_job_web
  draper
  dynamic_form
  facebox-rails
  factory_girl
  figaro
  fog (~> 1.3.1)
  forgery
  gritter (= 1.0.2)
  haml-rails
  heroku
  hirb
  htmlentities
  jquery-fileupload-rails
  jquery-rails (~> 2.3.0)
  jquery-ui-rails
  lol_dba
  magic_encoding (~> 0.0.2)
  mailcatcher
  marginalia
  merit
  meta_request (= 0.2.1)
  newrelic_rpm
  paperclip
  pg
  quiet_assets
  rails (= 3.2.9)
  rails-dev-tweaks (~> 0.6.1)
  rails-footnotes (>= 3.7.5.rc4)
  rails_12factor
  rails_autolink (= 1.1.4)
  rails_best_practices
  ransack (~> 1.0.0)
  rmagick (= 2.13.1)
  rspec-rails (~> 2.11.4)
  s3_direct_upload
  sass-rails
  selenium-webdriver (= 2.41.0)
  sextant
  simple-private-messages (= 0.0.0)!
  sqlite3-ruby
  textile_editor_helper (>= 0.0.30)
  thin
  timeline_fu
  turbo-sprockets-rails3
  uglifier
  unicorn
  will_paginate
  workless (~> 1.1.3)
tute commented 10 years ago

merit only supports Ruby 1.9.3 and up: https://github.com/tute/merit/blob/master/.travis.yml#L3. Not sure if it's related, but I suggest you to upgrade (latest version is 2.1.1). So the two problems persist, and I can't replicate them:

  1. Repeated has_merit addition to the model.
  2. uninitialized constant Sash on some merit calls.

I don't know how to investigate them, if you get news please don't hesitate to share.

mayinx commented 10 years ago

Ok - I keep you posted...

tute commented 10 years ago

Closing for now, will reopen if I can reproduce the errors! Thanks for your input.