Displaying 1 result from an estimated 1 matches for "find_count".
Did you mean:
bind_count
2006 Apr 20
1
Returning Count from find_by_sql
I want to return an int from a find_by_sql call. But when I use that
result to compare to another count the error tells me I have an array.
MODEL:
# Returns the number of comments in a specified post
def self.find_count(post_id)
find_by_sql(["SELECT COUNT(*) FROM commments WHERE post_id = ?",
post_id])
end
CONTROLLER:
def test
@post = Post.find(@params["post_id"])
@comment =
Comment.find_next(@params["post_id"], @params["position&...