English 中文(简体)
3. 采用特别积极记录模式,作为世界投资机制独一无二的登记册
原标题:Trying for a special Active Record Model which works as a unique WORM registry

I am trying to create a Model of a pretty special kind.

I just call it Emails. Containing fields like:
address
send_count
blocked

它是电子邮件地址的登记册。 载有电子邮件地址的其他模型中的每一记录都应参考这一模式的记录。 这样,我就可以阻止/禁止和电子邮件以其他方式在全球讲话。

如果它没有被普遍放弃,那么我可以说,这一地址应该像主要钥匙那样做。 我只能打造,然后永远不会更新,它必须是独一无二的。

我在这样做时遇到的问题(通常主要关键)是如何处理通过特赦的属性更新电子邮件/作为相关模式的个案。 这是最常见的情况,因为电子邮件地址仅向申请的用户看上去任何其他领域。

它们可以编辑其会计表格,并改变其电子邮件地址。 电话应当注意到这一点,“定型_or_create”本身不应更新地址。 另一方面,应允许更新被封锁的财产。

我一想一看一看一面? 谁能就如何使《示范法》成为类似做法向我提出一些建议?

我曾尝试过一些使用确认书和追索书的改动,但我似乎可以“自行”加上另一个现有记录。 仅仅确定现有记录的所有属性(包括id)并不能真正使事情充分发挥作用。

任何想法都是有益的。

问题回答

暂无回答




相关问题
Codeigniter WHERE on "AS" field

I have a query where I need to modify the selected data and I want to limit my results of that data. For instance: SELECT table_id, radians( 25 ) AS rad FROM test_table WHERE rad < 5 ORDER BY rad ...

Problem find joined table in rails

I have model represent association rule (Body => Head) def Item has_many :heads has_many :bodies ... end def Rule has_many :heads has_many :bodies ... end def Body belongs_to :item belongs_to :rule ...

FreeTDS Bad token from the server (SQL Server)

Today we had a lot more activity than normal between our Ruby on Rails application and our remote legacy SQL Server 2005 database, and we started getting the error below intermittently. What is is? ...

Castle ActiveRecord: one-to-one

While playing around with one-to-one associations in castle activerecord I stumbled upon the following problem: I m trying to model a one-to-one relationship (user-userprofile in this case). I ...

Sending email updates: model or observer?

I have an Event model, which stores an event feed for each user. I also need to email the updates to users which have enabled email notifications in their profile. From an architectural point of view,...

activerecord has_many :through find with one sql call

I have a these 3 models: class User < ActiveRecord::Base has_many :permissions, :dependent => :destroy has_many :roles, :through => :permissions end class Permission < ActiveRecord::...

热门标签