No commit activity in last 3 years
No release in over 3 years
Active Record Attributes Equality is a very simple rails plugin / gem that forces ActiveRecord to compare the model's attributes in the presence of two new records. Otherwise, it compares their IDs, just like ActiveRecord::Base#==.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 3.0.0
 Project Readme

Introduction

Active Record Attributes Equality is a very simple rails plugin / gem that forces ActiveRecord to compare the mode's attributes in the presence of two new records.

Example

Consider a User model that holds the notion of users that have a name.

  # create_table(:user, :force => true) do |t|
  #   t.string :name, null => false
  # end
  class User < ActiveRecord::Base; end

  Default ActiveRecord behavior:

  User.new(:name => "John") == User.new(:name => "John") #=> false

  Introduce ActiveRecordAttributesEquality and that same instruction will return true:

  User.new(:name => "John") == User.new(:name => "John") #=> true

Installing

As a gem (using bundler)

gem "active_record_attributes_equality"

As a Rails 3 plugin

rails plugin install git@github.com:GnomesLab/active_record_attributes_equality.git

Feedback, questions, improvements, critics or just say hi

Feel free to fork the project and to send pull requests with your changes. Should you run into problems, please use the issue tracker made available in this Github project.

License

Copyright (c) 2010 Gnomeslab, released under the MIT license. For more information regarding this license type please check the MIT-LICENSE file.