Displaying 20 results from an estimated 800 matches similar to: "a possible bug in Has_many :through using :soucre"
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 =>
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
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 May 27
7
How should I select rows from a join-model based on more than one association?
A concrete example:
We''re building a system to organize the information about workshops
being held in various conventions. A convention has more than one
workshop, and each workshop can be held in more than one convention.
Also each workshop has a host, who is specific to a workshop being
held in a specific convention.
For example, Matz may host an "Introduction to Ruby"
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 Oct 13
3
Validation errors in has_one/belongs_to relationships.
I have two objects, QuoteInput and Insured.
QuoteInput has one Insured and Insured belongs to QuoteInput.
I don''t understand what I''m seeing.
I assign an Insured to a QuoteInput. The Insured object has invalid
data.
I call save! on the quote input. QuoteInput has no validations.
I expect two things to happen - 1) an exception should be thrown,
indicating that there was a
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
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''
2007 Jun 11
3
ActiveRecord::StatementInvalid error
Hi,
I have an application that is running fine on two different machines,
but when I ported the code to a third machine, it doesn''t seem to
work. More specifically, for users with a significant amount of info,
it seems to stop working. All the functionality seems to be working
properly on a small test set, but with a larger set I get the
following error:
AssociatedAp Load (0.000000)
2025 Jan 02
2
[Bug 3772] New: scp "lost connection" failure
https://bugzilla.mindrot.org/show_bug.cgi?id=3772
Bug ID: 3772
Summary: scp "lost connection" failure
Product: Portable OpenSSH
Version: 9.9p1
Hardware: Other
OS: Windows 10
Status: NEW
Severity: major
Priority: P5
Component: scp
Assignee: unassigned-bugs at
2006 Jan 23
5
validates_uniqueness_of :username, :if => !self.new_record?
Hi all
I want users to register on my page. To register, they only have to
deliver an email and a password. Then a link with an activation token
will be sent to them, and after clicking the link the user sees a page
where he should fill in further details, means: a username.
My model looks like this:
class Member < ActiveRecord::Base
validates_presence_of :username, :if =>
2006 May 19
5
How to determine if an object has just been created
Is there a built-in way to determine if a model object has just been
created (ie. this object was the one that was originally persisted)? I
can''t see it anywhere in the AR code, but thought I''d check. I want
something like:
p = Person.create
p.original_instance? # true
Is this built-in or should I just patch AR?
-Jonathan.
2008 Jan 31
4
reby-debug and rspec
How do I use the ruby debugger with a specific test (not the whole spec file)? I want to do something like this.
$ rdebug spec/models/user_spec.rb -s "should error if not new_record"
____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search.
2006 Mar 19
2
Multiple polymorphic belongs_to declarations
I have the following models:
class Card < ActiveRecord::Base
belongs_to :deck
belongs_to :front, :polymorphic => true
belongs_to :back, :polymorphic => true
end
class TextContent < ActiveRecord::Base
has_one :card, :as => :front
has_one :card, :as => :back
end
The conflicting has_one declarations don''t work. What I need is
2006 Aug 15
3
update or alter cart
I want to modify and update the items in the Depot - "display_cart".
Since the cart is in a session, its a little hard to get at the data.
I just want to create a way to change quantities, prices and
recalculate.
Has someone done this, and could you point me to the right direction.
Thanks
Chas
--
Posted via http://www.ruby-forum.com/.
2006 Feb 16
1
validations with associated object
Does anyone know if Rails is supposed to validate associated objects on
creation?
Say you have a User model, with has_many posts, and a Post model which
belongs_to user. Further, the Post model has a validates_uniqueness_of
:title.
u = User.find(1)
# this should pass
u.posts.create :title => ''my new post title''
# this should fail
u.posts.create :title => ''my
2010 Feb 20
23
Rails 3 possible bug in Routing
Hi, I just ran into this ActionController::RoutingError and just
wanted to check if someone can confirm this as a bug in the Rails 3
beta gem.
config/routes.rb contains:
get ''login'' => ''session#new''
post ''login'' => ''session#create'', :as => :login
GET /login works fine:
Started GET
2007 Mar 21
6
ORACLE DESC "table_name" Failure
I am getting "DESC CYCLEMSTR" failed; does it exist?
errors on a table named CYCLEMSTR in Oracle every 3 out of 4 trys to
do a simple find(:all) on the table.
It is a legacy table that only contains 12 rows of join information.
I don''t understand why it works one out of every 4 or 5 times
help please.
trace:
(eval):3:in `describe''