grep -r -n 'GLOBALS' /path
grep -r -n 'GLOBALS' /path | wc -w
Post
.where.not(id: @posts_hot.map(&:id))
.where.not(id: Post.where(post_block_id: 2)) # magic number anipattern. лучше заменить на константу
.where.not(id: Post.joins(:post_asset).where.not(post_asset: { quote: nil }))
.order(created_at: :desc)
.limit(15)
Post
.includes(:post_asset)
.where.not(id: @posts_hot.map(&:id))
.order(created_at: :desc)
.limit(15)
.select { |post| post.post_block_id != 2 }
.select { |post| post.post_asset.try :quote }
get "/categories/:year/:month/:day/:id", to: "categories#whateveryouwant"
resources :post_categories, path: '', only: :show do
resources :posts, path: '/:year/:month/:day', only: :show,
constraints: { year: /\d{4}/, month: /\d{2}/, day: /\d{2}/ }
end
# В контроллере:
@posts = Post.includes(:post_category)
# Во вьюхе:
<% @posts.each do |post| %>
<%= post.post_category.name %>
<% end %>