similar to: Problems with form_for, STI, and polymorphic routing

Displaying 20 results from an estimated 3000 matches similar to: "Problems with form_for, STI, and polymorphic routing"

2011 Jul 08
0
Looking for Help/Advice on StackOverflow Question - Polymorphic Association with STI
I am having trouble with an many to many polymorphic association with STI involved. The problem is described clearly in the following StackOverflow question, so I will leave this thread short: http://stackoverflow.com/questions/6582074/activerecord-has-many-through-polymorphic-associations-with-sti I am posting here hoping to get advice/direction/a solution for this, as I''ve so far been
2010 May 07
1
Can't eagerly load a polymorphic association defined in an STI parent class?
If I define an association (in my case a polymorphic one) in an STI parent class, and try to eagerly load it in a subclass, I get the following error: ActiveRecord::ConfigurationError: Association name ''myassoc'' was not found; perhaps you misspelled it? If I redefine the same association again in the STI subclass, it works. Is this a bug or what? -- You received this message
2007 Oct 27
0
STI vs Polymorphic Associations
I have a MasterEvent model. It has attributes that is required by another model Event. The user selects the MasterEvent model and I create the Event model by merging the attributes of the selected MasterEvent with the attributes that were presented for the Event model in the form. I have association declarations in the MasterEvent and Event models. If I use STI does the subclasses inherit the
2006 Sep 22
2
possible to create polymorphic relationship with STI models?
I would like to associate a ‘product’ model with 3 models inherited from ‘image’: part, action and accessory. I have it working with Has_many :through relating products to images through attachments, I then have to determine the ‘type’ of the STI extension. This means i have to go product.images. While this is ok, i can see it getting tricky when i want to go products.images <<
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
2007 Aug 09
7
Integrating polymorphic models into controllers views? how?
I''m having trouble trying to get this to work. How the heck do you get a polymorphic controller to work? Especially integrating it with a view? Let''s say that we have shows, and episodes, then comments. A show has many episodes, an episode has many comments. the route is /shows/1/episodes/1/ Now to add a comment to that episode, how would I do it? Let''s say that the
2008 Jan 02
6
problem when editing record in polymorphic relation
I have the following three models created applying the polymorphic concept ========================================================================== class SoftwareCi < ActiveRecord::Base has_one :ci, :as => :content end class HardwareCi < ActiveRecord::Base has_one :ci, :as => :content end class Ci < ActiveRecord::Base belongs_to :content, :polymorphic => true end The
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.
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
2008 Jun 06
1
STI vs Polymorphism
Hello everyone, I am racking my brain with a modelling question and can''t wrap my around the benefits of STI or Polymorphisms. I am trying to model Questions and Answer behavior but I think I am not using rails full power here. I have (in simple terms) Question has_one Answer Answer belongs_to Question I also have Topic has_many Posts Post belongs_to Topic Now i am
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
2007 Sep 25
21
form_for and partials
I love form_for, but I really hate <% form_for :person, @person, :url => {...} do |f| %> ... <%= render :partial => ''form'', :locals => {''f'' => f} ... <% end %> I''ve been thinking of instead allowing <% form_for :person, @person, :url => {...} do |f| %> ... <%= f.partial ''form''
2011 Apr 05
1
Why does AR use base_class for polymorphic relationship "type"
I have a couple models that inherit from a base class that then inherits from AR. When they are used in a polymorphic relationship the "type" is always the base class. Just curious if anyone has a reason why it doesn''t use the *actual* class rather then the base_class. I have patched AR to use the actual class if !base_class.table_exists? but it adds another query each time
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
2009 May 12
2
STI good or bad for my problem?
Hi. I am currently developing a small course system for student and teachers. The system is divided in sections and sections have many messages, comments, documents and schedules. Pretty easy to set up using ROR, just add some belongs_to and has_many relations. But everything becomes much more complicated when the section items (message, comment and so on...) all has comments. And they can also be
2011 Jul 20
2
polymorphic assoc seems only best for multiple parents ?
I have done a little polymorphic associations stuff and have refreshed my memory on it again. What it seems like is that if I have a particular record and I want to make it easy for many different parent records to associate with it using has_one or has_many, that is fine. If I want a parent record to have multiple kinds of children through one association, I don''t see how to do that
2006 Feb 06
4
Relationship Question (STI)
My girlfriend and I have been dating for two years, and she just told me she has an STI... Actually, I currently have three different models, like: Dog, Whale, Monkey They all have some similar attributes, but, they are unique enough to break into their own models. I could use STI, but I think the table would just have too many columns. Now, I wanted to let the Dog''s, Whale''s
2006 Apr 25
7
undefined method form_for ?
Seems the only issues I ever have with Rails are these bizarre fiddly little things that make no sense. Can''t for the life of me understand why I''m getting undefined method on form_for in a view? And it''s actually part of the acts_as_authenticated plugin that''s doing it. But how can it not know about form_for? -- Posted via http://www.ruby-forum.com/.
2010 Jul 09
1
STI vs Polymoric
Hi all, I am also which one will be better STI or polymorphic for my app. thanks in advance -- 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
2007 Dec 28
1
Nested resources form_for problem
Hi, I have a resource map like this: map.resources :users do |user| user.resource :sreg10record end So a User is supposed to have (at most) one Sreg10record. The problem is in the views. I tried following this tutorial: http://www.akitaonrails.com/2007/12/12/rolling-with-rails-2-0-the-first-full-tutorial which proposes something like: <% form_for( [@user, @sreg10record] ) do |f|