Displaying 20 results from an estimated 400 matches similar to: "has_many.count not accepting options hash"
2007 Jan 16
3
odd error with sqlite3 adaptor
Any idea what would cause this?
>> icps = Icp.find(:all)
ActiveRecord::StatementInvalid: SQLite3::SQLException: unsupported file
format:
SELECT * FROM icps
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_recor
d/connection_adapters/abstract_adapter.rb:120:in `log''
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_recor
2007 Feb 08
5
a possible bug in Has_many :through using :soucre
I''ve been stumped on this for a few days and I''m not sure if it''s an error
on my end or an actual bug.
I have a system where I have workshops and users. Workshops have students,
presenters, and troubleshooters. I wanted to represent this simply by
using has_many :through with :source.
Workshop
has_many :presenters, :through =>:presenterships, :source=>:user
2006 Apr 06
4
Record retrieval in Many-to-many using :through not working
Hello,
I get an error while retrieving records from the following model structure.
Tables
foods - id, food
foodallergies - food_id, symptom_id, a few other columns
symptoms - id, symptom
Models
class Food < ActiveRecord::Base
has_many :foodallergies
has_many :symptoms, :through => :foodallergies
end
class Symptom < ActiveRecord::Base
has_many :foodallergies
has_many :foods,
2006 Dec 20
4
undefined method `fullname' for #<User:0x357e380>, BUT works on first view?
Hi all,
Please excuse the long post, but I wanted to make sure you have all the
information....
I have a NewsModel that looks like this:
class News < ActiveRecord::Base
belongs_to :user
validates_associated :user
validates_length_of :title, :description, :minimum => 5, :allow_nil
=> false
acts_as_commentable
acts_as_taggable
def self.find_recent
News.find(:all,
2007 Nov 15
0
Problems connecting to remote Oracle DB on windows using active record
I am trying to connect to an older oracle DB remotely, I think version
8 or 9. I downloaded the instant client stuff from oracle and copied
oci.dll and oraociei10.dll to my windows/system folder (windows XP) I
get the error.
C:\rb-play>ar_connect_ss.rb
env.c:257:in oci8lib.so: ORA-12514: TNS:listener does not currently
know of serv
ice requested in connect descriptor (OCIError)
from
2006 Jan 16
2
ActiveRecord: table name with spaces?
Howdy.
I''m trying to work with a legacy SQL Server database where some of the
table names have spaces in them.
I''ve done set_table_name "tablename with spaces", but I can''t get
find(:all) to work. I get the following error (because apparently
it''s not putting [ ] around the name as is required for SQL Server for
names with spaces.
2008 Sep 13
4
Setting up RoR with Postgresql ---heeellpp!
Hi there, I''ve been trying for a few hours now to get RoR and postgresql
talking - but I''m very confused about what''s going on (I''m running
windows btw).
I haven''t created a database in postgresql (I''m assuming that RoR will
do that?)
my database.yml looks like this:
production:
adapter: ruby-postgres
database: rails_production
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
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
2006 Jun 23
1
''Series'' Pluralization
Howdy,
I have a model I called ''content_series''. I created it and noticed that
Rails called it ''Sery'', so I added ''series'' to the uncountable thing in
the config, like this:
Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, ''\1en''
# inflect.singular /^(ox)en/i, ''\1''
#
2006 Jun 27
3
Weird ActiveRecord Foreign Key Problem
Hello to all,
I ran into a weird problem with an ActivRecord. I have a table named
"build_order" with a column named "type" that is a foreign key to a
table called "building_type". In a controller I try to read all the
build_orders with "BuildOrder.find :all" and get the following error and
stack trace:
(eval):1:in `instance_eval'': compile
2006 Jul 28
1
putty mysql error
I get the following mysql error when I try to connect to my Linux
machine using putty.
Unknown database ''db_develoment'' (Mysql::Error)
any idea what i need to do to avoid this.
The same code works pefectly well on the Linux box.
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/ven?dor/mysql.rb:508:i
n `read'': Unknown database
2006 May 05
1
Help with ActiveRecord
Model:
class AdminQueue < ActiveRecord::Base
set_table_name ''adminqueue''
end
Interacting with it in script/console
>> AdminQueue.new
=> #<AdminQueue:0x240a910 @attributes={"topic_id"=>nil,
"resolved"=>nil, "updated_on"=>nil, "action"=>nil, "type"=>nil,
"post_id"=>nil,
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 Jun 24
5
Rake vs Ruby for running tests (error discrepency)
I''m having (to me) a strange problem with errors when running my tests
with rake as opposed to using ruby. If I do rake test:units I get this
error for several tests, but not all:
13) Error:
test_player_has_game_statistics_for_season(PlayerSeasonTest):
ActiveRecord::StatementInvalid: Mysql::Error: Duplicate entry ''22'' for
key 1: INSERT INTO positions (`name`, `id`,
2006 Aug 09
1
Migrating a Field to External Model
I have a model Product with an attribute ''brand''. Currently it is a
simple attribute, however, I am migrating it to a separate model
Brand so that I can have other attributes with each brand. I created
the the model and created and ran the migration to create the new
table. So far so good. Then I created a separate migration to
transfer the data. The up method
2006 Jul 28
3
Forms: handle foreign keys (AssociationTypeMismatch)
Hi all
I tried and tried and tried, but I still fail in creating a form with
proper validation and stuff for foreign keys... So I''d really like to
get some help here.
I''m creating a booking site for DJ''s, and for every booking one can
choose one of different countries:
class Booking < ActiveRecord::Base
validates_presence_of :country_id
2006 Apr 14
1
rake test errors
I have Rails 1.1.2, ruby 1.8.4 and gentoo linux running kernel 2.6.15.
Here are the errors:
gregg@gregg2 ~/user/DMS $ rake test
(in /home/gregg/user/DMS)
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/
ordered_options.rb:2: warning: method redefined; discarding old []=
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/
ordered_options.rb:11: warning: method
2007 Feb 07
3
Gem problem with ActiveRecord/Oracle (without rails)
I have written the small script below. I have the ruby-oci adapter
installed, the newest version of gems and the newest version of
ActiveRecord. When I run the code I''m getting the follow error following
my code. It seems to be an issue with gems as far as I can tell. Any
help?
Thanks,
Drew
Code:
require ''ruby_gems''
require ''active_record''
2006 May 28
7
Self-referential has_many :through relationship
Hi,
I have a self-referential has_many :through relationship setup to
track relationships between users. Basically relationships are
modeled as a join table with an extra column ''relation''.
create table relationships (
user_id integer unsigned not null,
friend_id integer unsigned not null,
relation char(1) not null,
)
--- relations ---
f = friend
r = request to