{"created_at >= ? AND created_at < ?", "2016-06-23", "2016-06-24"}@posts = Post.where(user_id:123).includes(:comments).where(comments: { created_at: Time.zone.today...Time.zone.tomorrow })def admin?
role == 'admin'
endf = Foo.select(:bar).first
# выведет bar
f.bar
# будет ошибка, т.к. этот атрибут не был загружен
f.baz function Name() { return var = 1; } # В контроллере:
@posts = Post.includes(:post_category)
# Во вьюхе:
<% @posts.each do |post| %>
<%= post.post_category.name %>
<% end %> validates :email, uniqueness: { scope: :subscribe }, if: :subscribe?validates :subscribe, inclusion: { in: [true] }