Displaying 20 results from an estimated 4000 matches similar to: "has_many :through ... What am I missing?"
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 <
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 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 22
2
Relating Namespaced Models
I am dealing with a large project. I use a lot of STI and therfore have
a lot of models. I''d like to use namespaces to help organize my models
but am having trouble getting started.
I have a base model Term::Base located in /app/models/term/base.rb:
class Term::Base < ActiveRecord::Base
set_table_name "terms"
end
I have a non-namespaced client model:
class Client <
2008 Jul 08
0
Bug with serialized columns in console ?
Hi,
I recently added 2 serialized columns in my class Server :
class Server < ActiveRecord::Base
serialize :visa, Hash
serialize :appli, Array
...
No problem in my controller and my application and everything works as
expected : Excel exports following the "visa" Hash or "appli" Array
are ok.
But since I added the visa Hash, I can''t load the record with
2011 May 07
4
Activerecord::JDBCError: Invalid column number
Hi,
I''m rather new to Ruby and RoR, so I do not really know whether this ist
the right forum to place my question.
For my first ''project'' I planned to create a simple online-viewer, which
grabs data from an existing database and make them visible in a
structured form via browsers. So I thought that could be the right
beginner-project, because I have only read datasets
2011 Aug 31
2
stumped on how to reorder factors
I am trying to reorder a factor data type so that when I plot stats
associated with the factor, the ordering makes sense.
For instance, if I have a factor entered as follows ...
A = as.factor(c("1", "10", "3", "3", "10", "10"))
levels(A)
... the ordering does not really make sense (assuming I want the factor
ordered by integer
2007 Mar 22
2
Enumerable sum oddity
Hi.
In this setup "account has_many :consultations". Can anyone explain
the following behaviour to me? Rails 1.2.2. The "sum" method should
return 0 for an empty array.
>> a = Account.find(1)
=> #<Account:0x39c80a8 @attributes={...}
>> a.consultations
=> []
>> a.consultations.sum(&:foo)
ArgumentError: wrong number of arguments (1 for 2)
2012 Feb 29
1
equivalent from gladder and ladder from stata
Dear community,
Apologies, I'm still pretty newbie. Anyway, I am performing linar regression
analysis. As a common cause of non-normally distributed residuals is
non-normally predictor variables, i'm interested in achieving the best
transformation of the predictors.
I've seen some commands at R, but I would like to know if it exists a
command equivalent to gladder (graphic display)
2010 Aug 19
1
has_many :through question
I am trying to create an association table using the ":through" option
in "has_many" but not having success. I have created the necessary
migrations of the association tables and run rake db:migrate
I have the following model:
class Group < ActiveRecord::Base
has_many :users, :through => :group_user
has_many :invites, :through => :group_invite, :class_name =>
2007 May 28
1
upload_column problems on post after validation error
Hi to all the crew !
I''ve a little (big ?) problem.
I''m using upload_column plugin, it works very well but it throws an
exception when I try to repost the form after a validation error.
Here some details:
Model: (hostel.rb)
HOSTEL_PHOTO_DIR = Proc.new {|inst, attr| "hostel/#{inst.id}"}
HOSTEL_PHOTO_THUMB = "100x100"
HOSTEL_PHOTO_NORMAL =
2006 Jul 31
2
ambiguous column name in has_many :through
In my application model I have three classes: Accounts, Projects, and Items
class Accounts < ActiveRecord::Base
has_many :items, :through => :projects, :source => :items
has_many :late_items, :class_name => ''Item'', :through => :projects,
:conditions => [''due_on < ?'', Time.now], :source => :items
end
class Projects <
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
2009 Nov 17
5
has_many :through and foo.bars.include?
hallo everybody,
i already googled the following problem, but there are so many
questions regarding "has_many :through", that i just couldn''t find
what i was looking for. so, i''m really sorry if this has been asked
before. if so, just drop me the link.
i have a has_many :through relationship similar to the following
example:
class Group < ActiveRecord::Base
2007 Jun 23
3
has_and_belongs_to_many and dynamic find
Hi
Just curious if anyone can explain why using a dynamic find fails to
work with << operator
I have standard habtm relationship
class User < ActiveRecord::Base
has_and_belongs_to_many :roles
Now when I assign a Role via << after saving the new User I get wierd
behaviour
but only when using the dynamic version of find
i.e
@user = User.new(p)
if @user.save
#
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
2008 Jan 16
0
[CruiseControl] RubyOnRails build 8649 failed
The build failed.
CHANGES
-------
Revision 8649 committed by gbuesing on 2008-01-16 20:07:10
Introducing DateTime #utc, #utc? and #utc_offset, for duck-typing compatibility with Time. Closes #10002
M /trunk/activesupport/CHANGELOG
M /trunk/activesupport/lib/active_support/core_ext/date_time/calculations.rb
M /trunk/activesupport/test/core_ext/date_time_ext_test.rb
TEST FAILURES AND
2007 Jul 04
5
stack level too deep
Hi,
I have a SystemStackError. Here is the stack (sorry if it''s a little
long) :
app/models/line_item.rb:14:in `product''
app/models/line_item.rb:14:in `product''
app/controllers/store_controller.rb:188:in `redirect_to_paypal''
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/associations/association_proxy
.rb:123:in `each''
2017 Jan 17
2
pcapsipdump or general sip debug question
Hello,
There is a built-in tool in Wireshark for this : menu Telephony => Voip
Calls, the select your call and click on "Flow Sequence".
Best regards
Jean Aunis
Le 17/01/2017 ? 12:27, Yves a ?crit :
> Hi,
>
> I am using pcapsipdump for debugging sip calls.
>
> when I have to debug a call, pcapsipdump generates two files per
> call... one for the sip dialog
2005 Dec 27
0
How do I combine :finder_sql and :conditions to perform a sub-search on a custom has_many relationship?
I''m sure there''s something right under my nose that I''m missing.
I have two tables with two parallel one-to-many relationships. I wish
to use the :finder_sql parameter to essentially ''or'' the two foreign
keys.
What isn''t working for me is performing a ''sub-search''.
Let''s say the tables are "stores" and