What do you mean for 'domain' methods? Do you mean validations, etc? They
can be implemented; the model could be a sort of "struct on steroids"...
something like this:
module ActiveRecord
class Struct < ::Struct
def self.find
end
def self.all
end
# other various implementations
end
class StructFor
def [](table_name)
# retrieve table column names
ActiveRecord:::Struct.new(*table_column_names)
end
end
end
model:
class User < ActiveRecord::StructFor[:users] # this returns
ActiveRStruct.new(:firstname, :lastname, :active)
def before_save
# ...
end
end
Il giorno sabato 21 luglio 2012 22:03:06 UTC+2, Steve Klabnik ha scritto:
>
> The DAO pattern is totally different than the ActiveRecord pattern, so
> you probably won't see anything like this happen inside of AR itself.
> Other ORMs may do something like this, though.
>
> If your model is just a struct, then it has no 'domain' methods...
>
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Core" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-core/-/KAK9EQK1Qs8J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en.