I am trying to iterate through the versions of my Day model in a view,
and want to apply some model methods to it. Here’s an example:
<% day.versions.reject!{ |v| v.version == 1 }.each do |d| ->
<= d.process_date_this_version >
< end %>
I get a “undefined method `process_date_this_version’ for
#day::version:0x33b44f0” error. If I run it against d.day, things
run fine, but that’s querying the latest revision, which isn’t
desirable. What would be the preferred way to iterate through the
versions, and run models from my Day model on the Day::Version models?
Any help would be appreciated.
Thanks.
On Nov 8, 2007 12:56 PM, Justin W. [email protected] wrote:
run fine, but that’s querying the latest revision, which isn’t
desirable. What would be the preferred way to iterate through the
versions, and run models from my Day model on the Day::Version models?
Any help would be appreciated.
acts_as_versioned supports extensions like associations, so you can
define behavior on both models. This is actually my favorite feature,
and it’s why aav is written the way it is (vs using some diffing
algorithm or storing all versions for all models in a single table)
acts_as_versioned do
def process_date_this_version
end
end
–
Rick O.
http://lighthouseapp.com
http://weblog.techno-weenie.net
http://mephistoblog.com