У меня проблема, с которой я просто столкнулся (по какой-то причине), используя time_ago_in_words. После публикации публикации я получил
translation data {"one"=>"1 minute", "other"=>"{{count}} minutes"} can not be used with :count => 9
Я тоже не делаю ничего интересного, просто называя небольшую вспомогательную функцию
def friendly_publish_date(post)
return '' if post.publish_date.nil?
if post.publish_date >= 1.day.ago
"#{time_ago_in_words post.publish_date} ago"
else
post.publish_date
end
end
Теперь это отлично работает целую вечность, затем я пытаюсь опубликовать сообщение сегодня утром, и он начинает бросать предыдущее исключение. Любые идеи?
EDIT: произошло снова, так что вот полная трассировка стека по запросу.
Processing PostsController#index (for 74.213.163.234 at 2010-01-05 11:43:26) [GET]
Parameters: {"action"=>"index", "controller"=>"posts"}
Rendering template within layouts/application
Rendering posts/index
ActionView::TemplateError (translation data {"one"=>"less than a minute", "other"=>"less than {{count}} minutes"} can not be used with :count => 1) on line #5 of app/views/posts/_post.html.erb:
2: <header>
3: <div class='preheader'>
4: <time datetime="<%= datetime_format(post.publish_date) %>">
5: <%= friendly_publish_date(post) %>
6: </time>
7: <h6>
8: posted by Matt Briggs
/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/i18n-0.2.0/lib/i18n/backend/simple.rb:149:in `pluralize'
/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/i18n-0.2.0/lib/i18n/backend/simple.rb:35:in `translate'
/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/i18n-0.2.0/lib/i18n.rb:195:in `t'
app/helpers/posts_helper.rb:17:in `friendly_publish_date'
app/views/posts/_post.html.erb:5
app/views/posts/index.html.erb:22
app/views/posts/index.html.erb:19:in `each'
app/views/posts/index.html.erb:19
app/controllers/posts_controller.rb:9:in `index'
passenger (2.2.8) lib/phusion_passenger/rack/request_handler.rb:92:in `process_request'
passenger (2.2.8) lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
passenger (2.2.8) lib/phusion_passenger/railz/application_spawner.rb:385:in`start_request_handler'
passenger (2.2.8) lib/phusion_passenger/railz/application_spawner.rb:343:in`handle_spawn_application'
passenger (2.2.8) lib/phusion_passenger/utils.rb:184:in `safe_fork'
passenger (2.2.8) lib/phusion_passenger/railz/application_spawner.rb:341:in`handle_spawn_application'
passenger (2.2.8) lib/phusion_passenger/abstract_server.rb:352:in `__send__'
passenger (2.2.8) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
passenger (2.2.8) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
passenger (2.2.8) lib/phusion_passenger/abstract_server.rb:163:in `start'
passenger (2.2.8) lib/phusion_passenger/railz/application_spawner.rb:209:in`start'
passenger (2.2.8) lib/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'
passenger (2.2.8) lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
passenger (2.2.8) lib/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'
passenger (2.2.8) lib/phusion_passenger/abstract_server_collection.rb:80:in`synchronize'
passenger (2.2.8) lib/phusion_passenger/abstract_server_collection.rb:79:in`synchronize'
passenger (2.2.8) lib/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
passenger (2.2.8) lib/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
passenger (2.2.8) lib/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
passenger (2.2.8) lib/phusion_passenger/abstract_server.rb:352:in `__send__'
passenger (2.2.8) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
passenger (2.2.8) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
Rendering /home/mattcode/mattcode.net/public/500.html (500 Internal Server Error)