Displaying 20 results from an estimated 1000 matches similar to: "[MySQL] extended count function for use with queries containing a GROUP BY clause"
2006 Jan 19
7
bug in has_many count?
I can submit a patch, but wanted to confirm I''m looking at this right...
The docs indicate that if you specify a has_many association with
:finder_sql, but no :counter_sql, it constructs the appropriate counter
sql by substituting the SELECT clause.
But has_many_association.rb doesn''t seem to do that -- it just passes
Base#count_by_sql the finder_sql, which doesn''t
2006 Jan 15
0
OS X Rails - Nuby
OK, I''m diving into new things - a .net programmer and windows user
trying to develop in Rails on my Mac. Initial setup was easy, and I had
things working and was thrilled with myself. Then I shut down. Next
time I booted up, mysql was acting all kinds of funny. I finally got
that working again (I *think* it mostly had to do with me not having the
right path, I unfortunately
2006 Aug 13
3
ruby and mysql syntax? tried single quotes, double, none, ...
Hi, how do i use passed in arguments and convert those to something sql
can understand? do the aliases have to be double qouted? single qouted?
i think i tried all but no avail...thanks!
def get_count(doctype, towne)
@profiles = Profile.count_by_sql("SELECT COUNT(*) from Profiles where
Profiles.doctype_id = 1 and town_id = towne")
end
--
Posted via
2006 Feb 09
2
postgres connection problems
Hello, I''m a newbie to rails and I am trying to do the Demo in the
November Issue of Linux Journal. Things go fine go fine until I try to
connect to my Postgres database (ver 8.1). At this point I get the
following error message
---- RoR error and trace back ----
PGError in Admin#index
could not connect to server: Permission denied
Is the server running on host "localhost"
2006 Jan 15
2
Please help - Rails hanging on mysql connection
Trying to get Rails and mysql running on OS X, and I''m a Nuby.
Everything ran smoothly when I first installed, but after rebooting
things were out of whack. I finally got back into mysql after
re-installing, and at first when I tried to connect with Rails/Ruby I
got a message that my client was not up to date. So after reading some
info online, I set my mysql passwords with
2006 Feb 18
1
sql logic is killing me
I know my thinking is sloppy.
I want to know how many clients currently in my facility are male...
My facilities_controller.rb
def list_fac
@placement_pages, @placements = paginate(
:placements,
:conditions => ["placements.facility_id = ?",
params[:facility_id] ],
:include => [:facility, :client],
:order_by => ''facilities.name,
2005 Mar 23
1
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (61)
I am getting random can''t connect to MySQL server errors on my Rails application
located at http://www.thedatingguy.com/blog
Do you have any clue why this is happening?
This is the error:
Mysql::Error (Can''t connect to local MySQL server through socket
''/tmp/mysql.sock'' (61)):
2006 Jan 05
2
Rails 1.0 Crashing: Errno::EPIPE (Broken pipe):
Since we upgraded to Rails 1.0 and lighty last week we''ve had the rails
application crash daily with the following error in the production.log
file:
Errno::EPIPE (Broken pipe):
/usr/local/lib/ruby/1.8/mysql.rb:1042:in `flush''
/usr/local/lib/ruby/1.8/mysql.rb:1042:in `write''
/usr/local/lib/ruby/1.8/mysql.rb:462:in `write''
2007 Aug 06
4
problem with rails_root
Hi everybody,
I used a openseradmin who is based on rubygem (i suppose ), so when i
start my server of this openseradmin in the http://localhost:3000, i
reciceved some messages like this:
SocketError in LoginController#login
getaddrinfo: Name or service not known
RAILS_ROOT: script/../config/..
Application Trace | Framework Trace | Full Trace
2006 May 18
8
Concatenated key
Hi all,
I started playing a couple days ago with Rails and it find it very
interesting.
But I''m a bit stuck with making it work with a concatenated primary key.
I want to use my own names for the DB fields and I''m using SQL Server
2005.
My tables look roughly like this:
CREATE TABLE USERS (
USR_ID VARCHAR(25) NOT NULL PRIMARY KEY,
USR_PASS VARCHAR(25)
)
CREATE TABLE
2006 Feb 13
0
count_as_taggable distinctly
I needed to count tagged records, I came up with this:
<pre>def count_tagged_with(options = {})
options = { :separator => '' '' }.merge(options)
tag_names =
ActiveRecord::Acts::Taggable.split_tag_names(options[:any] ||
options[:all], options[:separator])
raise "No tags were passed to :any or :all options" if
tag_names.empty?
2006 Feb 15
0
MySql adapter error
Most likely due to something I misconfigured and/or broke when trying to get
the new polymorphic acts_as_taggable to work...In short, after installing
that gem and then trying to run gem install mysql on my windows server, I''ve
been getting this weird error on every page I try to hit.
If anyone give give me any insight into how I messed this up or how to fix,
it would be much
2006 Feb 21
0
Rails edge breaks my app
I set my app on the Rails edge yesterday via rake freeze_edge and that broke
my app. If I take the ..\vendor\rails folder out and restart the server
(webrick), it works fine. I don''t get any errors. But if I re-add the
..\vendor\rails folder I get errors when accessing any views that have
pagination. Is this a known issue or problem? This is the error:
ActiveRecord::StatementInvalid in
2006 Feb 21
6
Select articles from group with id ''1'' and id ''2''
I have to tables: "articles" and "groups". Between I have
article_groups as a jointable. Now I want to select every article who
is a member of group with id ''1'' and id ''2''. Whats best way to get
that?
Extract from schemas:
CREATE TABLE articles (
id int auto_increment,
ingress text NOT NULL,
story_text longtext,
constraint fk_items_users
2005 Apr 26
0
NoMethodError (undefined method `fetch_fields' for nil:NilClass)
Hi
I''m new to Rails (and Ruby) and I can''t get it to work properly.
Every time I want to do something with my database-connection (e.g.
use scaffold) I get this, or something similiar (from development.log):
>> Beneath this code there''s some more text <<
-------
Processing CategoryController#index (for 127.0.0.1 at Tue Apr 26
21:43:45 CEST 2005)
2006 Jan 21
2
problems in moving an application database from a local to a remote mysql server
hi.
i''ve an application which is using a local mysql server (on
localhost). i then moved the mysql server to another machine (remote
host) and changed accordingly the "database.yml" file.
when i launch webrick from the "localhost", it can connect to the
database but as soon as i call a controller of the application (for
example
2006 Jan 07
8
Using find_by_sql to get the sum of a column
Hello,
I was wondering if there was a method in Rails that returns the sum of a
column. For example, I have a column called ''score'' and writing a SQL
statement such a ''select sum(score) from table_name'' does return the sum
of the values in the column. In the past (not too long ago being a
newbie), I defined all sorts of methods only to discover that Rails
2005 Mar 10
0
Need Help with Flaky FastCGI on Windows
Hi Everyone -
I have a rails 0.10.1 application deployed on a Windows 2003 server
under XAMPP Lite 1.4.12. Running under CGI, the application works fine
(a bit slow, obviously, but no problems).
When I run under FastCGI, the app is fine until I leave it alone for a
few hours. For example, last night I switched it to FastCGI and
everything seemed to be working fine. When I woke up this
2006 Feb 25
5
MySQL client ran out of memory
I''m getting the following error unexpectedly for my rails app. I just
exported the databae from dreamhost and imported it on textdrive for
my rails app.
Mysql::Error: MySQL client ran out of memory: SELECT COUNT(*) FROM
comments WHERE (comments.listing_id = 2666)
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract_adapter.rb:88:in
2006 Jun 20
2
Problem with "can''t dump anonymous class Class"
I submitted this earlier, but the web forums went down and I''ve screwed up
the thread, so I''m starting over.
I''m trying to built a document upload system. The system has a main
Document model with different subclasses for different types of documents.
With the code below, if I attempt to create a Document, it works fine, but
if I attempt to use one of the subclasses, I