I’m playing with Radiant on my Macbook. I installed Ruby 1.8.4, rb-
sqlite3 and more with Darwin Ports. Then rubygem. I did gem install.
Set up a Radiant site, edited database.yml for sqlite. Ran setup and
selected option 3, the blog example as per the Radiant demo. Then I
launched via Mongrel.
Well, it works. Fast and good. Lovely. Except for one thing. The
archives works, shows a list of posts. But the Archives by Month does
not work. I get no articles. Empty page for August 2006. Even tho’
there clearly should be. This is with a default, unedited install.
Does anyone know of anything obvious to check?
BTW, it may be IOTTMCO but why, in the admin page edit, are Save and
Save and Continue Editing both buttons, but Cancel is a plain link?
This will show you how to set up the archive page properly, including
the proper behavior.
I’ll certainly check there but my point was that I am running Radiant
as downloaded and setup using setup_database. I did not do or change
anything else. So either: a) the download is different from the demo;
b) something about mongrel/sqlite/my-machine is causing an issue.
No mind. I’ll work through the demo pages and compare.
By a “default, unedited install” do you mean that you have added
nothing to the archive page itself? If so, that’s your problem … you
still need a bit o’ code to get things running.
I mean that I selected Option 3 in setup. There was code in the %B %Y
Archives page that, on cursory inspection, seemed the same as that on
the demo site.
Lets drop it for now. I’ve updated Rails and Radiant and I’m starting
again. Which, as of last night was bombing out with Active Record
errors.
By a “default, unedited install” do you mean that you have added
nothing to the archive page itself? If so, that’s your problem … you
still need a bit o’ code to get things running.
Just to make sure that I wasn’t losing it, I installed Rails 1.1.6,
reinstalled Radiant 0.5.1 using the gem, created a new radiant site
using option 3, and fired it up … it works for me.
I’ve just done the same and it doesn’t work :-(. I verified that the
page is exactly as per the demo. I get monthly archive links in the
sidebar for August and June, click on them, get an August 2006 page
with no articles.
Gotta be my setup.
Oh well.
BTW, I’m also having to run under Rails 1.1.5. When I edit
environment.rb to be 1.1.6, I get an error
Just to make sure that I wasn’t losing it, I installed Rails 1.1.6,
reinstalled Radiant 0.5.1 using the gem, created a new radiant site
using option 3, and fired it up … it works for me.
BUT, STRFTIME(‘%m’ returns a character value, such as ‘06’, whereas
it’s being compared to the integer 6. I tested in sqlite3 and no rows
returned. Wow, 17 years of Oracle experience counts for something in
this Web world.
So, strftime needs to be wrapped with a string-to-integer conversion,
yes?
That sounds fine to me. Can you or someone else get me a unit test that
reproduces the problem? Maybe even a patch that fixes it?
OK, I’m new to Rails and sqlite and MySQL, so this took me half an
hour but…
The development log showed this SQL:
SELECT * FROM pages WHERE (pages.parent_id = 4 AND ((((virtual = ‘f’)
and (status_id = 100)) AND (STRFTIME(’%m’, published_at) = 6)) AND
(STRFTIME(’%Y’, published_at) = 2006))) ORDER BY published_at DESC,
virtual DESC, title ASC
Which I traced to the archive_finder.rb in models. This line:
when /sqlite/i
case part
when /year/i
"STRFTIME('%Y', #{field})"
when /month/i
"STRFTIME('%m', #{field})"
when /day/i
"STRFTIME('%d', #{field})"
end
BUT, STRFTIME(’%m’ returns a character value, such as ‘06’, whereas
it’s being compared to the integer 6. I tested in sqlite3 and no rows
returned. Wow, 17 years of Oracle experience counts for something in
this Web world.
So, strftime needs to be wrapped with a string-to-integer conversion,
yes?
reproduces the problem? Maybe even a patch that fixes it?
The unit tests were already broken for sqlite3 in regard to this
problem. I just put a patch on trac [1] to solve it. I’m also running
on OS X (10.3.9) and sqlite3 (from darwinports).