Displaying 20 results from an estimated 70000 matches similar to: "ActiveRecords::Calculations trouble"
2006 Jul 27
1
ActiveRecords::Calculations
I have my Model<ActiveRecord::Base ,
but whenever I try something like
Model.calculate() or Model.maximum ...
I get NoMethodErrors.
Why can I use any of the other ActiveRecord methods, but none from
Calculations
and what do I do to remedy this?
thanks
--
Posted via http://www.ruby-forum.com/.
2006 Dec 27
0
HABTM Checkboxes - Adding/Updating Users to a Project
Hello all,
I''m trying to create a HABTM checkbox action that adds/updates ''users''
to a ''project''.
I have the following laid out.
---------------------
TABLES
---------------------
create_table "assignments", :id => false, :force => true do |t|
t.column "project_id", :integer, :default => 0, :null => false
2006 Jul 09
0
2 ActiveRecord Calculations
Hi, I am trying to use active record calculations to perform two
calculations.
1. Get the sum for each group.
2. Of those groups, find the maximum number of that sum
I have the first step done, I just can''t figure out the second step.
Any ideas?
Here is what I have right now:
@total_points = BlahPoint.sum(''value'', :group => ''blah_id'')
Then
2008 Nov 12
5
dynamic condition for has_one and eager loading issue
Hi,
I ve defined the following relation in one of my models with a dynamic
where condition:
has_one :selection,
:foreign_key => ''object_id'',
:conditions => ''selection_type = 1 and account_id = #
{self.send(:account_id)}''
That works perfect, however when I try to eager load that relation I
am getting the following error when doing a
2006 Jan 30
0
cached_model-1.0.1 ActiveRecords + memcache
The new version of cached_model features bug fixes and tests!
Bugs fixed:
Updating a model no longer stores associations into the cache. This
could cause strange, hard-to-debug bugs when an invalid set of
assocations was retrieved along with a cached model.
Reloading a model refreshes the cache.
When CachedModel::find can''t understand query params and a single
result is
2006 Apr 10
3
Problems with multiple ActiveRecords and Validations
Hi all,
I am a RoR newbie and have the following scenario set up:
There are 2 ActiveRecords involved, the first one being "User", the
second one being "Visibility".
The corresponding users table holds address informations regarding a
User. The visibilities table holds visibility settings for the
individual columns of the users table (i.e. firstname, lastname, country
2006 Jul 07
1
Pessimistic Locking Plugin Breaks ActiveRecord::Base.count()
After installing the PessimisticLocking plugin I noticed that
ActiveRecord''s count method no longer works (see below). If I remove
the plugin it resolves the problem.
I need both. Any ideas?
I have also read that Pessimistic Locking is now baked into ActiveRecord
in Edge Rails. I have tried Rails 1.1.2 and 1.1.4 and that doesn''t seem
to be the case. Any idea when
2007 Apr 10
0
Having some trouble with rspec on rails.
Hi guys,
I''m having some trouble with RSpec on Rails. Specifically, whenever I
run the specs separately they''re fine:
spec spec/controllers/*.rb
spec spec/models/*.rb
Or if I run them with TextMate..., but whenever I use the RCov Rake
task from the RSpec page (or if I run all the specs together) I get
failures:
rake rcov
spec spec/*/*.rb
spec spec/models/*.rb
2006 Jun 22
0
Domain modelling and ActiveRecords
Hi all,
I am wondering if this could be a good idea to support the Object#extend method for an ActiveRecord class.
Let''s say I have a customer (with a corresponding customer table in the DB). At one point, this customer becomes a "BillableCustomer" (with data in another table for billing information).
Wouldn''t it be nice to write:
customer.extend(Billable)
2006 Mar 08
0
call activerecords private methods
Maybe there is an obvious answer and I''m being dumb,
but why does activerecord allow me to call it''s
private methods?
>> i = Item.find(33)
=> #<Item:0x2360080 @attributes={ ... output removed
>> i.price = ''25''
=> "25"
>> i.update
=> 1
>> i.create_or_update
=> 0
>> i.price = ''26''
=>
2006 Apr 18
6
Postgresql and ActiveRecords problems
Hi all. I have a problem with postgresql PK columns and ActiveRecord.
The error is: PGError: ERROR: null value in column "item_id" violates
not-null.
Ok, it''s wrong to insert NULL into PK columns, but rails doing it. How
to fix? So sad..
2006 Jun 09
0
Calculations based on multiple tables
Hi there,
I''m trying to grab all the contest_entries from a particular contest, and
then grab all the appropriate contest_ratings associated with the songs and
contest. The end result is an average score for each song involved in each
contest.
I made an ERD of my table structure which can be found at:
http://antrover.com/erd/contest_question.jpg
Here''s my model structure:
2006 Sep 06
5
admin controller problem
I am reading the agile web development with rails book, and starting to
create the depot. I am getting the below error after setting up the
"ruby script/generate scaffold Product Admin" does anyone know what the
problem is?
NameError in AdminController#index
uninitialized constant Mysql
RAILS_ROOT: ./script/../config/../
Application Trace | Framework Trace | Full Trace
2006 Apr 20
1
has_many.count not accepting options hash
has_many.count does not seem to support an options hash like
ActiveRecord::Base.count does.
Example:
>> AcademicProgram.find(:first).course_requirements.count :conditions
=> "courses.name LIKE ''a%''", :include => :course
=> 40
>> ap.ap_requirements.count :conditions => "courses.name LIKE ''a%''",
:include =>
2006 Feb 09
1
(no subject)
My application has one central database + Rails server and many
distributed GUI clients. The remote clients need to read and update
different collections of ActiveRecords. They also need to submit
fairly demanding calculation + database update requests.
Have you designed a similar Ruby application? What did you do?
I''ll try to summarize the approachs I''m considering
2006 Aug 11
0
count not working?
I''m having some trouble with the count method on AR objects. Here is
a stack trace:
>> t.subscriptions.count
ArgumentError: wrong number of arguments (2 for 3)
from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/
lib/active_record/calculations.rb:160:in `add_limit!''
from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/
2006 Nov 04
0
ProbleM!!!!!!!!!!!!!!!!!!
Hi,
I trieed umpteen times to connect ruby on rails to MSSQL server using
the standard procedures and I always get the samw error. As I was
previously working with MYSQL I faced no problem .Now at a time critical
situation I need a solution for this...........
Open
OLE error code:800A0E7A in ADODB.Connection
Provider cannot be found. It may not be properly installed.
HRESULT error
2006 Mar 13
4
Trouble Using AR Object based on a Piggyback Query?
Hi,
I''m new to Rails and Ruby and can''t access methods/columns from an
ActiveRecord object that is a "piggy-back" row as described by David
here: http://www.loudthinking.com/arc/000235.html
Via Console I can create the piggyback object but reading attributes
gives "TypeError: cannot convert String into Integer" (this is in
Console and the browser).
2006 Aug 02
4
Model still using mysql
When calling a Result.find_by_content on my model, I get the following
error:
Mysql::Error: Table ''db.results'' doesn''t exist: SHOW FIELDS FROM results
Yes, I remembered to put acts_as_ferret. Any ideas?
Trace:
2006 Aug 07
0
deployment failures with sqlite3
Hello list,
I''m attempting to deploy my first rails app on textdrive and have run
into a problem. I currently have lighttpd running and I am able to
start my rails app. When I attempt to visit my site I get an:
Application Error (Rails)
Investigating my production.log it looks like the app isn''t finding
sqlite3, right? Do I need to pack that with the app? What about non