search for: count_all

Displaying 20 results from an estimated 24 matches for "count_all".

Did you mean: umount_all
2006 Nov 22
0
Returning objects (not ids) in grouped count
...plication. I want to return a list of topics with their posting counts, filtered by a user id. This: Topic.count :conditions => ["user_id = ?", 1], :joins => "INNER JOIN postings ON topics.id = postings.topic_id", :group => "topics.id", :order => "count_all DESC" Returns an array of arrays, each array containing a topic id and count, like: [[302, 12], [110, 7]] That''s because the SQL generated by my command above looks like: SELECT count(*) AS count_all, topics.id AS topics_id FROM topics INNER JOIN postings ON topics.id = postings...
2006 Oct 25
3
rails app breaks after pg restart
...rash with this error: ActiveRecord::StatementInvalid (PGError: FATAL: terminating connection due to a dministrator command server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. : SELECT count(*) AS count_all FROM matches ): Strange thing is, after a do a page refresh everything works again. It''s like the connections are re-established and all is well. But I have to do it for each application that is running, really annoying.. Does anybody know what is going on here? Jeroen
2006 Aug 12
4
form problem on deployment. Not sure how to debug this.
...biostats SQL (0.002079) BEGIN Biostat Update (0.024918) UPDATE biostats SET `date` = ''2006-08-11'', `height` = 0.0, `weight` = 0.0 WHERE id = 8 SQL (0.049138) COMMIT Biostat Load (0.001343) SELECT * FROM biostats ORDER BY date SQL (0.000597) SELECT count(*) AS count_all FROM biostats Biostat Load (0.000851) SELECT * FROM biostats ORDER BY date LIMIT 1 Photo Columns (0.024376) SHOW FIELDS FROM photos SQL (0.000631) SELECT count(*) AS count_all FROM photos Photo Load (0.001020) SELECT * FROM photos ORDER BY RAND() LIMIT 1 Rendered stats/_statRow (0.0...
2006 May 03
2
Perplexing nested transaction issue
...RECIPIENT MISSING: __Loop Start SQL (0.000315) BEGIN Mail Load (0.000446) SELECT * FROM mails WHERE (mails.id = 62) LIMIT 1 ??? UPDATE RECIPIENT MISSING SQL (0.000180) COMMIT ==Recipient Saved - false SQL (0.000157) BEGIN SQL (0.002060) SELECT count(*) AS count_all FROM recipients WHERE ( recipients.mail_id = 62) Mail Update (0.000386) UPDATE mails SET ... `status` = 1 WHERE id = 62 Recipient Load (0.004454) SELECT * FROM recipients WHERE ( recipients.mail_id = 62) ORDER BY name SQL (0.001372) COMMIT --Mail Saved SQL (0.000273)...
2006 Jul 10
0
Strange acts_as_paranoid behavior
...anoid plugin with rails 1.1.4 (model also uses acts_as_threaded and acts_as_taggable) and getting some unexplainable behavior. The following tests: assert_equal Conv.count, num assert_equal Conv.count_with_deleted, CONVS_TOTAL Produce the following SQL: SQL (0.000000) SELECT count(*) AS count_all FROM convs WHERE (( convs.deleted_at IS NULL OR convs.deleted_at > ''2006-07-09 19:46:18'' ) AND ( convs.deleted_at IS NULL OR convs.deleted_at > ''2006-07-09 19:46:18'' )) SQL (0.000000) SELECT count(*) AS count_all FROM convs WHERE (convs.deleted_at...
2006 May 18
1
ActiveRecord problems from within template
...tions => ''credit_types.personnel_type="live_action_personnel"'' If I try and test this for emptiness: if @film.live_action_personnel.size > 0 I get the following error: MysqlError: Unknown table ''credit_types'' in where clause: SELECT count(*) AS count_all FROM credits WHERE (credits.film_id = 16 AND (credit_types.personnel_type="live_action_personnel")) but if I debug(@film.live_action_personnel) earlier within the same template, all is well! It seems that ActiveRecord isn''t generating the right query when I only need to count th...
2007 Apr 04
1
pontential bug in rspec_on_rails and ActiveRecord transactions
...39;') INSERT INTO contacts (`internal_id`, `name`, `updated_at`, `primary_email`, `notes`, `user_id`, `created_at`) VALUES(NULL, NULL, ''2007-04-04 15:35:46'', ''user at example.com'', NULL, NULL, ''2007-04-04 15:35:46'') SELECT count(*) AS count_all FROM urls ROLLBACK How did count statement got into transaction? Is rspec doing some magic with ActiveRecord that is causing this to happen? Thanks for your help, Esad
2006 Jun 06
1
Please Help with single table inheritance relationships
...Now, this all makes some sense to me, but I don''t know that it makes Rails sense (and there is no validator or Relationship Manager to tell me if it is valid syntax or set of commands), and it does not run: SQLite3::SQLException: SQL logic error or missing database: SELECT count(*) AS count_all FROM addresses Since the table does exist I''m stuck. What''s my next step? Anyone know a CVS or SVN with an example which might clear things up for me? Thanks, -Chris -- Posted via http://www.ruby-forum.com/.
2009 Dec 03
2
AuthLogic Question - one time password (persistence_token) - what config is required to use this???
...quot;action"=>"new", "controller"=>"user_sessions"} User Columns (3.4ms) SHOW FIELDS FROM `users` User Indexes (0.9ms) SHOW KEYS FROM `users` Rendering template within layouts/application Rendering user_sessions/new SQL (0.6ms) SELECT count(*) AS count_all FROM `users` WHERE (last_request_at > ''2009-12-02 20:04:24'') Completed in 182ms (View: 151, DB: 5) | 200 OK [http://localhost/ user_session/new] (c) But then the web-page ends up on the login page, and not automatically on the page I was after - i.e. I was expecting that the o...
2010 Jan 21
2
nested forms and attr_accessable
Rails 2.3.5 I am working on a nested form that assigns roles to users through a table called clearances. I have attr_acessable turned off globally in an initializer: ActiveRecord::Base.send(:attr_accessible, nil) I have this set in clearance.rb attr_accessible(:description, :effective_from, :role_id, :superceded_after, :user_id) And this is what params looks like after the
2006 Aug 12
6
params not getting POSTed
I have a situation where no params are being sent when the form is submitted. After the rendering this is the html that I get... <form action="/stats/new" method="post"> Height: <input id="stat_height_ft" name="stat[height_ft]" size="5" type="text" />ft </p> Weight: <input id="stat_weight_lbs"
2006 Oct 25
7
rest nested resources - Help please
I can''t believe I''m back again with another rest question. I did go through the peepcode podcast. I thought though you can have multiple nested resources, is that not true ? I have this set up map.resources :candidates do |candidate| candidate.resources :canbackgrounds candidate.resources :canpositions end I just coded up teh canpositions and now all
2006 Jun 07
1
Calling find on AR class, order by association count?
I suspect that this is going to wind up trivial and I''m going to slap myself in the head... Suppose I have User and Comment AR classes. User has_many :comments, Comment belongs_to :user I want to do a User.find, which returns User objects in order of which user has the most comments. I suspect that this involves renaming the COUNT(*) results of a sub-select so that I can order by
2009 Dec 23
0
Re: undefined method `count' for Array...
...ed it it seems that no one actually mentioned the real difference between these two calls. While they will produce the same end result the process of getting to that result is very different: n = User.all.size => 123 SELECT * FROM "users" n = User.count => 123 SELECT count(*) AS count_all FROM "users" Obviously the latter is significantly more efficient. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA...
2006 Aug 14
5
Tutorial for Queries
Hi! I''m looking for a good tutorial that explains the main points of performing queries with Rails. I do have AWDWR and have read the section on ''find'' but I''m looking for something that goes into more detail on how to perform queries across tables. Abstracted from my current application, this is an example: * person has_many sites * site has_one room *
2006 Jun 26
4
has_many :through
...e keyword_links for that listing. For instance, if my @listing has an ID of 7, I''ll still have keyword_listings with ''listing_id''s of 2, 3, etc. i notice (in the logs) when I loop through @listing.keywords and access keyword_link, AR makes a query of SELECT count(*) AS count_all FROM keyword_links WHERE (keyword_links.keyword_id = 13) obviously missing the listing_id part of the WHERE. what am I missing to make this happen? thank you, ed -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachmen...
2007 Aug 29
2
:order based on an aggregate value?
...n a list of all referrals, I''m displaying referral.date, referral.other_details, and also referral.sales.count. I want to able to sort this list by that last column -- the number of sales per referral. Abstractly, I want to do something like @referrals=Referral.find(:all, :order=>sales.count_all). But nothing like this works, because when this initial SQL statement is executed, the total sales per referral haven''t yet been calculated. They get calculated afterwards, in n separate queries. How to proceed? @referrals=Referral.find(:all, :include=>:sales) doesn''t really...
2006 Apr 24
4
Joined search returns NIL ids
I have two models: assets and makes. Make has many assets and an asset belongs to one make. I am calling this part of my asset controller from a search form with the parameters "search" (search term) and "field" (database field heading) which then renders a partial with the search results on it. ######################################################## if
2007 Sep 03
11
MySQL has gone away
...errors (see below) when we call rebuild_index in aaf. This happens sporadically. Any suggestions for what might be wrong or workarounds? I guess we try a reconnect before we call rebuild_index? Matthew ActiveRecord::StatementInvalid (Mysql::Error: MySQL server has gone away: SELECT count(*) AS count_all FROM bands ): (druby://localhost:3009) /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract_adapter.rb:128:in `log'' (druby://localhost:3009) /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/mysql_adapter...
2007 Oct 08
1
Rails reverses apostrophes
...i, I am quite new to Ruby on Rails so this might have a very simple answer... My problem gives the following error message when I try to call the count function for an item. Mysql::Error: Unknown column ''TournamentTemplate'' in ''where clause'': SELECT count(*) AS count_all FROM action_logs WHERE (action_logs.loggable_id = 1 AND action_logs.loggable_type = `TournamentTemplate`) The row that generates the error looks like this: <% if item and item.action_logs.count > 0 %> Action_logs is a polymorphic class, so "item" can be one of many loggable cla...