similar to: Polymorphic many to many linking

Displaying 20 results from an estimated 7000 matches similar to: "Polymorphic many to many linking"

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 14
2
object class with STI and Polymorphic Assoc''s.
Hi, lets say I have a a table, "Linkings" that I am using for polymorphic associations. One of the associations is to the "person" table, and there are several other associations. "Person" has 2 types, "slacker" and "suckup". It is modelled as such: class Linking < ActiveRecord::Base belongs_to :person belongs_to :linkable, :polymorphic
2008 Sep 29
1
has_one :through with :source. How to alias association?
Hi to everyone, I have the following models: class Attachment < ActiveRecord::Base has_attachment :content_type => [:image, ''application/pdf''], :max_size => 3.megabytes, :path_prefix => ''../private/attachments'', :storage => :file_system, :processor => :rmagick,
2006 Apr 04
1
What is the best way to handle this? It''s not a good use of the new Polymorphic-Association thingy is it?
Just getting back into Rails, so apologies. Just a bit of advice please. I''m trying to rewrite the change control app that I wrote originally in VB/Oracle. It''s used heavily by our project and customer and seems a good project to rewrite in rails, if not for this customer then perhaps for another. Anyway, I have decided to go with MySQL this time and have the following
2009 Jul 22
2
How to build scope for count() & has many polymorphic?
Hello, i have the following models in my application: class Message < ActiveRecord::Base has_many :comments, :as => :commentable, :dependent => :destroy, :order => ''created_at ASC'' end class Comment < ActiveRecord::Base belongs_to :commentable, :polymorphic => true end I need "commented" named scope, which do the follownig thing:
2006 Apr 22
9
one to many question
1. A category has parent categories. 2. A product is in many categories and a category has many products. 3. Products and category both have images in the same image table. ie. a product and / or category could have multiple images.<=== my question is related to this So among other things I presume I have to do the following: class Category < ActiveRecord:Base #...
2010 May 25
2
Site Navigation With Polymorphic Has Many Through
Hi, seem to keep running into a wall here. I can''t find any resources on site navigation that can deal with any model being in the nav, allow nesting, and can dynamically update. So I thought about it for a while, and decided on a MenuItems class, which contained the position of the child in relation to it''s siblings, where the parent and the child were polymorphic. Then a given
2010 Feb 08
5
Why are double sided polymorphic relationships lacking in Rails?
http://stackoverflow.com/questions/2224994/why-are-double-sided-polymorphic-relationships-lacking-in-rails -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to
2006 Mar 02
5
Two foreign keys on the same column?
Let''s say I have three hypothetical MySQL tables: ? people, with columns id, gender, and source_id belongs_to :boys and :girls ? boys, with columns id and name has_many :people ? girls, with columns id and name has_many :people The gender column in people specifies which of the two source tables the source_id refers to. For example, if we have values: 1, boy, 1 in people,
2006 May 13
1
Rake clone bug?
Hi. I''m having a problem with my testing. The following table in my development database (MySQL 4.1.12, InnoDB): +-----------------------+------------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-----------------------+------------------------+------+-----+---------+----------------+ |
2006 May 20
7
Polymorphic, many-to-many, self-referential data model
No matter what I try I''ve been unable to work how to get this to work with the cool ActiveRecord helpers. I''m not sure if it''s possible, Josh Susser''s blog suggests it is, but damned if I can work it out... I have: Container which can contain one or more Element. An Element is a polymorph of either a Container or a Chunk. An Element can exist in one or more
2006 Jul 08
1
conditional table association?
I''m using a db to log two types of events, link events and tag events. At first I had two tables, link_events & tag_events, but this seemed not very DRY because the only column that was different between them was link_id and tag_id respectively. So I made these tables: events: id int user_id int objtype_id int (holds ''1'' or ''2'' depending
2006 Apr 02
1
One to Many Relationship Issues
Hi, I am having issues with a one to many relationship(it never works :-)). Jokes aside, I am getting an error: Mysql::Error: #23000Cannot add or update a child row: a foreign key constraint fails: INSERT INTO adverts (`image_url`, `price`, `title`, `website_url`, `description`, `user_id`) VALUES(''bb'', 22.0, ''aa'',
2005 Mar 28
0
Handling return from modal pages on rails
Hi List, I didn''t like the way store_location worked in rails. It doesn''t know you''ve pushed the "back" button, and it always returns to the top of a page. On a large page, the part you were looking at would no longer be on the screen. People try to deal with this using an AJAX hack, but it seems to me that the proper way to fix it is to store the return
2006 May 24
0
polymorphic url and polymorphic partial helpers
Here are a couple of articles I wrote describing a couple of handy helpers for dealing with polymorphic objects. These helpers allow you to generate urls and render partials on objects without knowing what class they are ahead of time. http://www.sciwerks.com/blog/2006/05/24/polymorphic-urls/ http://www.sciwerks.com/blog/2006/05/24/polymorphic-partials/ Hopefully you will find them useful.
2006 Feb 27
6
One to Many example... please!
Hi, I am pulling my hair out trying to work out how to put together what should be a simple app in rails. The app is to CV''s so I have a table of CV''s and each CV can have multiple skills. Skills are in a 2nd table below; CREATE TABLE cvs( id INT not null AUTO_INCREMENT PRIMARY KEY, first_name VARCHAR(30) not null, family_name VARCHAR(30) not null, email
2011 May 03
2
Database performance for polymorphic associations under high load
Hey guys, I''ve been thinking lately about polymorphic associations, and I wonder: is there a noticeable or tangible performance "hit" from doing polymorphic associations when you''ve got your database under really high query load? So for example, maybe I have a "message" model, a "user" model and an "administrator" model, without any
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
2010 Mar 01
0
undefined method for Polymorphic association using Searchlogic
I am unable to call a polymorphic scope using the searchlogic plugin as it keeps on returning ''undefined method''. I am certain it is only a problem within my project as I created a test project and I was able to call a polymorphic scope using the searchlogic plugin. I am hoping someone can provide a suggestion on how to debug this issue. My project consists of several gems, and
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