public
Description: Uber lightweight Merb blogging engine. Make sure you check out the feather-plugins repo as well!
Clone URL: git://github.com/mleung/feather.git
Click here to lend your support to: feather and make a donation at www.pledgie.com !
Fixed the archive searcher to use repository.adapter.query instead of 
self.find_by_sql as the behaviour has changed. Also fixed the 
specific_date_function to no longer load up the config/database.yml
fujin (author)
Tue Jul 08 15:25:11 -0700 2008
eldiablo (committer)
Fri Jul 18 12:54:13 -0700 2008
commit  4904834fe0ae86fefa5ddbec97036aec104938e9
tree    7937a38eb0efb934acbe87196d08a9331501d1c9
parent  3ecb1bc008c4d7156f2e4dc6e3fe95b8e8726c0d
...
131
132
133
134
 
135
136
137
...
145
146
147
148
149
 
150
151
152
...
131
132
133
 
134
135
136
137
...
145
146
147
 
 
148
149
150
151
0
@@ -131,7 +131,7 @@ class Article
0
     end
0
 
0
     def get_archive_hash
0
- counts = self.find_by_sql("SELECT COUNT(*) as count, #{specific_date_function} FROM articles WHERE published_at IS NOT NULL AND published = 1 GROUP BY year, month ORDER BY year DESC, month DESC")
0
+ counts = repository.adapter.query("SELECT COUNT(*) as count, #{specific_date_function} FROM articles WHERE published_at IS NOT NULL AND published = 1 GROUP BY year, month ORDER BY year DESC, month DESC")
0
       archives = counts.map do |entry|
0
         {
0
           :name => "#{Date::MONTHNAMES[entry.month.to_i]} #{entry.year}",
0
@@ -145,8 +145,7 @@ class Article
0
 
0
     private
0
       def specific_date_function
0
- # This is pretty nasty loading up the db.yml to get at this, but I wasn't able to find the method in merb just yet. Change it!
0
- if YAML::load(File.read("config/database.yml"))[Merb.environment.to_sym][:adapter] == 'sqlite3'
0
+ if Merb::Orms::DataMapper.full_config[Merb.environment.to_s]["adapter"] == "sqlite3"
0
           "strftime('%Y', published_at) as year, strftime('%m', published_at) as month"
0
         else
0
           "extract(year from published_at) as year, extract(month from published_at) as month"

Comments

    No one has commented yet.