On Nov 8, 2007 12:56 PM, Justin Williams
<carpeaqua-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
> 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.
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 Olson
http://lighthouseapp.com
http://weblog.techno-weenie.net
http://mephistoblog.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---