Displaying 20 results from an estimated 60000 matches similar to: "Delete help needed"
2006 Mar 31
2
"Owning" a polymorphic
I''m playing around with RoR and I''m having trouble figuring out how to
describe a certain relationship. I''m building a social networking site
where you have users who can comment on other users, photos, videos, and
blogs. I''ve figured out how to have a comment belong to a user or media
item through a polymorphic relationships but I dont'' know how to
2009 Nov 12
0
Problem with has_many :through, :uniq => true with polymorph
Didn''t have quite enough space to describe it there...basically i''m
having a problem with the :uniq option in my tags.
I''m using acts_as_taggable_on_steroid which adds these associations to
my Resource class:
Resource
has_many :taggings, :as => :taggable, :dependent => :destroy, :include
=> :tag
has_many :tags, :through => :taggings, :uniq => true
2006 Jul 10
2
Polymorphic associations in reverse?
My app has an association that''s got me scratching my head.
I have Users, and Images. A User has many Images. (Yes, another
picture sharing app, but it''s for a small niche, and it doesn''t end
in -r!)
I would like to express a "Favorite" relationship between both Users
to Users, and Users to Images. This seems like the opposite of the
standard
2006 Jun 23
2
polymorphic challenge
Hello All,
I have a little challenge and I am not sure if this is even possible
I am working on a dating/event site and few functionalities are similar
that I want to centralize them.
We have users which can have
- favorite users
- interest list
- blocked users
All these relations are like;
User <-> Relation <-> User
I was thinking I could have a class called Relation (with a
2011 Jan 15
3
has_many :through with Single Table inheritance
I have the following model structure setup.
class User < ActiveRecord::Base
end
class Parent < User
has_many :relationships
has_many :children,
:class_name => "Student",
:through => :relationships,
:conditions => "related_as = ''parent''"
end
class Student < User
has_many :relationships
2006 Mar 08
0
combining STI + polymorphism + rich self HABTM : how to ?
Hi all,
I need to model simple typed polymorphic relations:
''John'' [''works_for''] ''Bill''
''John'' [''speaks_for''] ''Microsoft''
''Microsoft'' [''hold_shares_of''] ''Apple''
I''m having a hard time combining :
- S.T.I.
2006 Apr 28
2
file_column with polymorphic table relationship?
Hello,
I''m just starting out with both Rails and Ruby, so I hope this isn''t too
simple of a question - but I''ve been struggling to find a solution.
I''m using the file_column plugin to handle image uploads and thumbnail
generation. In addition, I''ve wrapped the image into a polymorphic table
so I can have uploaded images associated with multiple
2006 Jul 03
0
Modelling Relationships as objects
DHH in Rails Confeerence pointed out that abstract relationships should be
converted into concrete objects, CRUDying up relationships.
An example would be
class User < ActiveRecord::Base
has_many :subscriptions
has_many :news_categories, :through => :subscriptions
end
class NewsCategory < ActiveRecord::Base
has_many :subscriptions
has_many :users, :through => :subscriptions
2009 Apr 12
0
rails 2.3 nested forms with has_many through checkboxes
I was wondering if anyone knew of a way to combine the new nested
forms in rails 2.3 with a has_many through relationship via
checkboxes. Basically I have a page model, a page_category model and
a category_items join table. Pages have many page categories through
category items. The category_items table is polymorphic so i can use
it for other models who need categories (maybe this is
2006 May 05
2
Dumb polymorphic association question
Hi,
Why is it that polymorphic associations only work with the :has_many
and :belongs_to relationships? Why can''t it be a :has_one?
Matt
2008 May 13
0
Polymorphic naming difficulties
Hi all. I''m having a problem naming a polymorphic relationship. Here''s
my thinking...
First, an analogy. You''re walking through the mall. Through a window you
see a game you''re interested. I''m attempting to model the relationship
between your interest and the game you''re interested in.
I have an InterestList. It''s job is to maintain
2007 Oct 18
4
Polymorphic Association?
Hi there-
I''m a newbie to this board, RoR, and web development in general. So
please forgive me if this is in the wrong place or if the solution is
really simple...
I''m trying to conceptualize the relationships between a series of
models for a page creation function. What I''d like is to have a
Content Page which consists of a series of Content Blocks. The
Content
2006 Jun 17
2
how to delete a parent record and child records?
Wow, got myself lost as *soon* as I left the hand-holding exercises in
the books.
I''m trying to set it up so when I click the (scaffold-generated)
''destroy'' link on one (of a list) of parent MySQL records, the children
records in a different table get deleted also.
Very simple setup: my tables are ''customers'' and ''accounts''
class
2006 Feb 09
2
Polymorphic Associations
If anybody on edge familiar with this could help, that would be "great" :)
I have different types of things I want to be "reviewable". So, instead of
having a slew of HABTM... this new Polymorphic Associations schtick seemed
like the best solution. I have everything setup as I thought it should be
(so I think)... but it doesn''t appear to be working correctly. Here
2006 Apr 29
2
Seeing performance problems with has_many :through relation
Greetings all, I am looking for some insight from some of the more
experienced with has_many :through relationships as I am having a hard
time reconciling the performance I am seeing.
I have 2 tables that are linked together via has_many :through
Table 1: urls ( there are about 7,000 records )
2 fields, id and url
Table 2: phrases ( there are about 87,000 records )
2 fields, id and phrase (w/
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
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
2007 Jan 19
0
Do transactions fail with polymorphic has_one relationships?
I have an AR::Base descendant with a complex object graph beneath it,
like so:
ArtisanQuoteInput has_one QuoteInput and then QuoteInput has several
objects attached to it. Note that the relationship between
ArtisanQuoteInput and QuoteInput is polymorphic, so the relationship in
A is written
has_one :quote_input, :as => :program_quote_input
If @artisan_quote_input is an instance of
2008 Jun 12
1
unidirectional belongs_to polymorphic
The setup:
class Location::Base < ActiveRecord::Base
set_table_name :locations
...
end
class Location::Address < Location::Base
...
end
class Location::Airport < Location::Base
...
end
class Person < ActiveRecord::Base
belongs_to :location, :polymorphic => true, :class_name =>
"Location::Base"
...
end
I want a unidirectional belongs_to relationship. That
2006 Jun 03
8
confused about ActiveRecord relationships
I am very confused about where to put the belongs_to and the has_one
(and other relationship identifiers). I have read the RDoc and the
agile book many times about this and I think i still see it backwards.
Let me outline my app so you have an understanding...
I have 2 tables:
Schools { id, school_name, address_id }
and
Addresses { street1, street2, city, state, zip, country }
*** this