This commit is contained in:
Rico Sta. Cruz 2014-05-16 19:04:02 +08:00
parent 443db292e9
commit d13bd95045
2 changed files with 53 additions and 0 deletions

View File

@ -11,3 +11,51 @@ in config/environments/development.rb:
# Don't break apart # Don't break apart
config.assets.debug = false config.assets.debug = false
Partial locals
<%= render 'article', full: true %>
<%= render 'article' %>
<% if local_assigns[:full] %>
...
<% end %>
HTML in i18n
en:
read_more_html: "read <b>more</b>..."
Exception handling:
# config/application.rb
config.exceptions_app = self.routes
get '/404', to: 'errors#not_found'
get '/500', to: 'errors#server_error'
class ErrorsController
def not_found
render status: :not_found
end
end
Rails updating:
rake rails:update
Distinct pluck:
Article.distinct.pluck('author')
Relation#merge
scope :with_drafts, -> {
uniq.joins(:articles).merge(Article.draft)
}
Order
scope :recent, -> { order created_at: :desc }

View File

@ -71,3 +71,8 @@ layout: default
a, A - AM/PM a, A - AM/PM
Misc Misc
DDD, DDDD - Day of year DDD, DDDD - Day of year
Examples:
YYYY-MM-DD - 2014-01-01
dddd, MMMM Do YYYY - Friday, May 16th 2014