> Daniel Sheppard wrote:
> > In the interests of sanity, lets pretend that radiant never had 
> > a switch based on ActiveRecord::Base.connection.adapter_name. 
> > 
> > http://dev.radiantcms.org/radiant/changeset/447
> 
> Did this change preserve existing functionality?

Yes - all tests pass, and unless there's a database that doesn't 
allow comparison on date fields or I'm reading the code wrong it 
will do exactly the same thing.

> > I'd propose that we dump the archive_finder completely - it's 
> > only used from the tags, and now that the code is sane, there's
> > no need to keep it locked in a corner. Any objections?
> 
> And replace it with what? I'm not sure what you are proposing.

Each of the methods in archive_finder are used in exactly one place - 
the corresponding archive_xx_index_page tag. The code used to be quite 
complicated, and the day finder depended on the year and month finder. 
Now however, the code is quite simple and has no interdependencies, 
so I think the code would be clearer just inlined into the tags.

For example, the archive:children tag in archive_day_index_page would
be:

tag "archive:children" do |tag|
  if request_uri =~ %r{/(\d{4})/(\d{2})/(\d{2})/?$}
    start = Time.local($1, $2, $3)
    finish = start.tomorrow
    tag.locals.children = parent.children.find(:all, 
        :conditions => [
                'published_at >= ? and published_at < ?', 
                start, 
                finish,
        ]
    )
    tag.expand
  end
end

(code is actually more compact, but I've formatted across many lines
because something is wrapping my lines wierdly).

Dan.
_______________________________________________
Radiant mailing list
Post:   Radiant@lists.radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to