Code Monkey home page Code Monkey logo

active_record_ignored_attributes's People

Contributors

mkolenda avatar tylerrick avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

active_record_ignored_attributes's Issues

What about comparing assosications?

Hello.

Checking out your gem and it looks pretty good.

However I was wondering how would you go about comparing associations. Here is an example.

class Client
  has_many :addresses,  :as => :addressable,  :dependent => :destroy
  has_many :orders 
  validates_associated :addresses
  validates_associated :orders 
end

 class Address
   belongs_to :addressable, :polymorphic => true
 end

class Discount
  belongs_to :client
end

So consider these two cases:

Cient might have multiple addresses (shipping, billing, work, etc.), also if we introduce Warehouse model, it will need Addresses to - hence polymorphic association. So let's say I want to update a Client record. And the only thing that changed wasn't the actual client record, but the associated address ( let's say the zip code was wrong and I want to change that). How would I go about comparing for that?

Case 2
Let's say each client can have 2 types of discounts: Personal & Corporate . I want to add a new discount to a client, but before I save it I need to make sure one doesn't exist already and if it does maybe all i need is just change the discount rate, instead of creating a new discount.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.