Displaying 20 results from an estimated 1300 matches similar to: "Hitting unknown error with "can't dup NilClass""
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,
2007 Jul 17
5
habtm confusion
Hello friends!
I am trying to make a database that will have a group of people set to
committees, and a person can be in multiple committees, and a committee
obviously has multiple people. The people are senators at my
university. These are my current models:
senator.rb:
--
class Senator < ActiveRecord::Base
validates_presence_of :first_name, :last_name, :floor
has_and_belongs_to_many
2006 Mar 13
0
Problems with association named :task
I have an object that belongs_to :task, and calling that object''s task
method returns the task it belongs to in the unit tests. One place in a
controller, though, it gives me the error:
undefined method `find'' for Rake::Task:Class
./script/../config/../vendor/rails/activerecord/lib/active_record/associations/belongs_to_association.rb:44:in
`find_target''
2006 Jul 05
2
Serialized object behaves weird
Hi!
I got a class named EinsatzFilter which I serialized to session. Before
saving to session it works afterwards I keep getting the message:
"undefined method `to_s'' for #<Person:0x38c6ab8>". "Person" is a from
ActiveRecord::Base inherited class.
Code:
class EinsatzFilter
include ApplicationHelper
attr_reader :personen, :monat, :projekte, :kunde
2010 Oct 11
8
Nooby Stuck - "has_and_belongs_to_many" relationship
trying to set up a "has_and_belongs_to_many" relationship
would very much appreciate the help, not sure what im doing wrong at all.
Scheme.rb
class Scheme < ActiveRecord::Base
validates :schemename, :presence => true
belongs_to :user
has_many :levels, :dependent => :destroy
has_and_belongs_to_many :works
end
Work.rb
class Work < ActiveRecord::Base
2006 Jul 24
2
Thread.new with ActiveRecord under Mongrel vs. FastCGI
Hi All,
I''m going to end up hosting a site on a server in a fastcgi environment,
but I''ve been doing most of my development under mongrel. I have a bit
of code that spawns a thread, and in the thread it makes some remote
calls (openuri) and does some database inserts via activerecord.
When I do this under FastCGI, everything appears to work as expected.
When I do it under
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
2008 Nov 06
10
Rails 2.1.2 bug in include on has_many?
In my continued efforts to port my rails 1.x app to Rails 2.1.2, I keep
running into what appear to be ActiveRecord bugs.
I am using an :include on a :has_many definition:
class Request < ActiveRecord::Base
has_many :service_types, :order=>''service_types.id ASC'',
:include=>:service_response
[...]
There''s no reason this wouldn''t be supported in
2006 May 20
1
acts_as_paranoid overrides ActiveRecord::Base??
Guys,
I am trying to figure out what exactly does this line do at the end of
"acts_as_paranoid" plugin?
ActiveRecord::Base.send :include, Caboose::Acts::Paranoid::ActiveRecord
My problem: I have some classes that I use acts_as_paranoid, and others
with tagging support. Classes declared as taggable, throw error, which
appears to be in the acts_as_paranoid version of the
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 Mar 27
2
:through and STI
Hi,
I''m trying to use :through and STI using the trunk version of Rails, but
I get the following error see bottom of this msg[1]
here are my classes.
class Player < ActiveRecord::Base
end
class Ladder < ActiveRecord::Base
has_many :subscriptions
has_many :players, :through => :subscriptions
end
class SingleLadder < Ladder
end
class Subscription <
2007 Aug 15
2
has_many :through ... What am I missing?
class Ladder < ActiveRecord::Base
has_many :players
has_many :users, :through => :players
end
class Player < ActiveRecord::Base
belongs_to :users
belongs_to :ladders
end
class User < ActiveRecord::Base
has_many :players
has_many :ladders, :through => :players
end
When I try the following code (on the console) I get an error:
@ladder = Ladder.find(1)
@ladder.users
I
2005 Dec 13
7
MARK: targinfosize 8 != 4
Hello all,
I got this problem while trying to shape traffic with iptables MARK and
HTB.
MARK: targinfosize 8 != 4
--set-mark gives "invalid argument" error message.
Kernel version is 2.4.29 (some patches from patch o matic applied)
Iptables version 1.3.4
Intel x86 architecture.
I saw this problem discussed in a few places, but the discussions didn''t
come to a conclusion
2009 Jul 08
2
RuntimeError (JPEG marker not found!):
Hi,
while generating the PDF file , i am getting following error..
please help for me.
RuntimeError (JPEG marker not found!):
C:/Ruby/lib/ruby/gems/1.8/gems/pdf-writer-1.1.8/lib/pdf/writer/
graphics/imageinfo.rb:176:in `
measure_JPEG''
C:/Ruby/lib/ruby/gems/1.8/gems/pdf-writer-1.1.8/lib/pdf/writer/
graphics/imageinfo.rb:174:in `
loop''
2009 Jun 04
1
wrong number of arguments (1 for 0)
Hi,
I hope someone can help me because this is driving me crazy, I''ve
spent hours trying to track this down. I''m trying to convert a Rails
1.1 to Rails 2.3.2 and I''m getting the following error when trying to
save a many to many relationship. I''ve double checked all the
associations, I''ve used console to test my models and they all work
ok, I can do
2006 Apr 16
8
"Cannot convert String to Integer" after using association
So, I''ve written a partial that does some stuff with a given instance of
my class "entity". Entity is ActiveRecord. I''m able to retrieve all
sorts of data from an @entity, until I do something like:
<% for @attribute in @entity.attributes %>
<div id="attribute_<%= @attribute.id %>">
<%= render(:partial =>
2006 Mar 20
2
AHHHhhhhh... has_and_belongs_to_many, that is going on?
I don''t have a class by the name of "ReviewersScoreCard", yet my many to
many configuration looks as follows. And, these errors while running some
simple test with ./script/console is giving me a headache:
./script/console
Loading development environment.
>> r = Reviewer.find_first
=> #<Reviewer:0x19d0a48 @attributes={"id"=>"1",
2012 May 21
2
Error : can't dup NilClass, in Heroku
Hi,
The application is deployed on Heroku, is based on Ruby 3.2.1 and Rails
1.9.2. Sometimes a function of my props starts throwing this error "
StringUtils:dateTimeFromString, str , *can''t dup NilClass*" and I don''t
understand the cause. it''s my function:
require ''time''
module StringUtils
2007 Jan 10
3
ActiveRecord Error?
We spent a big chunk of yesterday hunting down a strange bug in one of
our rails apps and created a test project to try out different theories
on what was going on. The result so far is a very small test case app
that perfectly reproduces the problem. The question is, is there
anything *wrong* with what we''re doing here, or is it a problem with
ActiveRecord? We''re on rails
2006 Mar 22
15
Rails-1.1.0-RC1 tagged today (4010)
Looks like Rails 1.1.0 RC1 is finally here:
http://dev.rubyonrails.org/changeset/4010
--
Posted via http://www.ruby-forum.com/.