search for: comments_count

Displaying 7 results from an estimated 7 matches for "comments_count".

2011 Apr 24
2
False Positives In ActiveRecord Tests
...Here is one case in relations_test.rb. Can someone look at this and just tell me it is normal for other DBs and just odd for SQL Server? Or maybe it is just my understand of some SQL standard. I''m really not that SQL smart. Honestly. def test_count_explicit_columns Post.update_all(:comments_count => nil) posts = Post.scoped ... assert_equal 0, posts.where(''id is not null'').select(''comments_count'').count ... end OK, this passes in standard DBs, postgresql, sqlite3, and mysql. But why? There are 11 rows, all where comments_count is nul...
2006 Apr 03
2
Order By Number of Comments
Hi, I am new to Ruby on Rails, so I apologise if this has been answered elsewhere. I have had a look through the list but I can''t seem to find what I am trying to do. I have implemented the standard blog and comments app from the screencast. However I am trying to extend the functionality. I want to be able to display a list of posts and order them by the total number of comments
2008 Apr 14
2
Problems with nil object
Hi to all. I''ve a very big problem. I know this can seem very loing, but please, try to read it. I have a simply blog, with posts and their comments. I''ve two tables in my db, posts, with post id, text and comments_count to store the number of comments-children of each post (as recomanded to do in AWDWR); and the table comments, with comment id, post_id for the post they''re referred to, and text (there are many other fields, but they''re not importat here). I have a home_controller, this is the cod...
2006 Mar 10
1
Validate fields and display errors from two models?
Hi, I have here a problem I''ve been working at for a little while but I can''t seem to get the error messages to appear correctly. My form looks something like this for "ModelA": [errors_for "modelA"] [form for "modelA"] [text "modelA" "fieldname1"] [text "modelB" "fieldname2"] [submit] [/form] The reason
2006 Feb 27
0
Better counter_caches
...the number of belonging objects on the associate class through use of increment_counter and decrement_counter. The counter cache is incremented when an object of this class is created and decremented when it?s destroyed. This requires that a column named "#{table_name}_count" (such as comments_count for a belonging Comment class) is used on the associate class (such as a Post class)." So, all that''s possible is incrementing/decrementing "#{table_name}_count" when an item is created or destroyed. I think it''d be useful if :counter_cache also had this functio...
2011 Dec 16
3
PROBLEN IN AJAX USING RJS
...lt;b><%= @article.name %></b> </p> <p> Topic: <b><%= @article.topic %></b> </p> <p> Description: <b><%= @article.description %></b> </p> <div id ="notice"></div> <%#*<div id="comments_count">%> <%#= pluralize(@article.comments.size, ''comment'') %> <%#*</div>%> <div id ="comment"></div> <%= render :partial => "comments/comment", :collection => @article.comments %> <%= form_for(@comment, :...
2009 May 27
12
query on Ruby array
Looking for suggestions on following two queries. Query 1 ------------------------------ Are the two following lines of code different in Ruby / Rails ( in a *.html.erb) file. <% if @forms.count != 0 %> <!-- first code --> Vs. <% if @forms.count %> <!--second code --> @forms is an array of objects. Coming from "C" language development background, i thought