Я получаю ошибку SQL с этим:
Model:
class Comment < ActiveRecord::Base
belongs_to :user
belongs_to :entry
attr_accessible :body
validates :user_id, :presence => true
validates :entry_id, :presence => true
validates :body, :presence => true, :length => {:minimum => 10, :maximum => 5000} #spam/stupid protection
default_scope :order => 'comments.created at sec'
end
Controller
def show
@entry = Entry.find(params[:id])
@comments = @entry.comments.all
...
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @entry }
end
end
Вид прост:
<% if @entry.state > 2 %>
<section id="comments">
<% @comments.each do |comment| %>
...loop some stuff...