Displaying 20 results from an estimated 50000 matches similar to: "[PATCH] #6040 STI and Polymorphism docs"
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 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
2006 Mar 02
1
Fixture accessors broken for polymorphism, in need of redesign
Ticket 4052 (http://dev.rubyonrails.org/ticket/4052) just came through
trac, which introduces the need for a better way to access fixtures. I
believe the basic problem is the same as 3935
(http://dev.rubyonrails.org/ticket/3935) in that the accessor method
which is constructed by the fixture call can''t infer the class name
from the table name. The band-aid in 3935 was to allow you to
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
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 Aug 23
1
Re: STI and Joins Broken
Can I get some feedback on ticket 5838? I''ve got a patch and testcase
that works. Rick seems to be opposed to the patch because I''m not
solving all the join issues, but I''d argue that you should at the very
least get the sort of object your asked for back.
Account.find_by_sql() should -never- return something other than
Account objects.
--
Kevin Clark
2008 Jan 11
0
Request for review of STI/eager-loading patch
Hi,
Review would be appreciated on this patch which stops
find returning incorrect results when multi-level STI
models are eagerly loaded:
http://dev.rubyonrails.org/ticket/10624
--
We develop, watch us RoR, in numbers too big to ignore.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2006 Apr 26
10
save new model with child model
Hi,
I am having a problem saving a new model that has an associated child
model. If a new ticket is being created and will have one comment to
go with it then I tried this in my action
@ticket = Ticket.new(params[:ticket])
@comment = Comment.new(params[:comment])
@ticket.comments << @comment
if @ticket.save
@notice = "Ticket added. Thanks for
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
2008 May 12
0
Problems with form_for, STI, and polymorphic routing
I''m stumped on how to get past this. It''s Rails 2.0.2.
I have a class, Show. Using STI, I''m using that as a base class, and
have DayShow and NightShow that inherit from it.
###
class Show < ActiveRecord::Base
end
class DayShow < Show
end
###
In my shows/edit.html.erb, I have:
<% form_for(@show) do |f| %>
However, when I use it with a @show that has
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 Aug 23
2
Re: STI and Joins Broken
I''ve made a inheritance rework some weeks ago that would possible fix
it since it only loads the inheritance support in the class that''ll use
it.
In STI case, it would load only if the class that descends directly
from AR has been inherited and the column specified in the
inheritance_column is available.
People here told me to wait until next release so we can dig into this,
but
2007 Aug 02
2
STI functionality, but then with multiple tables
Hello,
I''m creating my own Tumblr [tumblr.com] like rails app.
It''s like a blog, but in this case a blog post could be of a certain
type, i.e. a regular post, a video, a link, a photo, a song(info).
Well now, it''s clear that they share a lot of similar functionality:
title, created_at/updated_at, commentable, probably has an author_id,
etc..
But besides that they are
2010 Mar 05
0
Question/possible bug on ActiveRecord serialize and STI
I''ve been running into a problem where ActiveRecord 2.3.5 isn''t
deserializing a serialized column in derived classes:
http://pastie.org/856463
I''ve been able to replicate this test with Ruby 1.8.6p369, 1.8.7p72,
and 1.8.7p174 on different systems, any thoughts?
Dustin Lundquist
--
You received this message because you are subscribed to the Google Groups
2008 Jan 04
1
eager loading and polymorphic associations
There is a dedicated section about eager loading in the docs. A
coworker discovered eager loading does not work in polymorphic
associations the hard way :-) so I''ve written a patch that documents it:
http://dev.rubyonrails.org/ticket/10610
There are at least a couple of tickets that implement something that
would change that though:
http://dev.rubyonrails.org/ticket/9640
2012 Apr 05
0
Polymorphism, acts_as_relation gem and nested attributes
I have the following polymorphic association set up with
acts_as_relation (https://github.com/hzamani/acts_as_relation)
Model code:
class Email < ActiveRecord::Base
belongs_to :detail
validates_presence_of :address
end
class Detail < ActiveRecord::Base
acts_as_superclass
has_many :emails
accepts_nested_attributes_for :emails, allow_destroy: true
2012 Sep 08
3
Polymorphic has_and_belongs_to_many association
Hi,
I''m currently having the situation where I have to implement a polymorphic
has_and_belongs_to_many by introducing an in between model that handles all
the "has_many :as" and "belongs_to :polymorphic" association
implementations... and is not doing anything else. Thing I don''t like it
here is, I am unnecessarily loading AR instances only to execute SQL
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
2006 Mar 22
14
currency conversion webservice in a rails app?
Hi,
I''m interested in using a currency conversion web service in my rails
app. Does anyone have a free service that they use and like? I found
this one
http://www.webservicex.net/WS/WSDetails.aspx?CATID=2&WSID=10
I''ve tried to make a simple, plain Ruby script to connect to this and
get a conversion rate without success.
How do I integrate a webservice into my rails app? I