Displaying 20 results from an estimated 3000 matches similar to: "Class Table Inheritance implementation"
2006 Mar 14
4
Two Customer Types - Best Design Principle?
Hi all,
I''ll do my best to explain this... I have the possibility to have two
customer types in my system:
1. A "mailing list" type: new records are saved when user enters email
address in the mailing list subscription form.
2. A "full" type: new records are saved when the user buys something and
provides all their billing/shipping details, etc.
Model:
-
2009 Jun 29
3
Table Inheritance based on a function
Hello,
we have a problem in a CMS project that we believe is basic for RoR
developement and could concern others as well - or have already:
RoR implements the ''Single Table Inheritance'' (STI) Pattern:
http://www.martinfowler.com/eaaCatalog/singleTableInheritance.html
.. through its ''ActiveRecord'' ORM.
The Fowler example mentions a ''type''
2005 Jan 13
10
Program logic behind Ruby On Rails
Hi, I''m a newbie in both Ruby and Ruby on Rails. I finished the Ruby on
Rail Tutorial on Todo list and it was great. But, now I''m trying to
understand the logic behind it, that is something that is not obvious on
how each one of them ties together.
Is there a flowchart that shows how the inner working of Ruby on Rails?
In another words, let''s suppose we consider the
2006 Jan 18
3
Support for foreign keys in Migrations
Is there any work being done to add support for defining foreign keys in
ActiveRecord Migrations? If not is it something that people would find
useful or do most people here believe in the "Application Database" style
over the "Integration Database" style [1] as defined by Fowler?
I''d love to see support for foreign keys in Migrations. For selfish reasons
2008 Jan 01
26
Did DHH have a suit on?
So I''m wondering about the origin of "ActiveRecord" and "ActionPack" and
the like in Rails.
I''ve always thought that perhaps DHH found himself in a suit one day
(maybe he had to attend a friend''s wedding or something), and as long as
he had the suit on, decided to lapse into a one of the barely lucid
frenzies that Marketing people are prone to when
2006 Mar 27
1
polymorphism + inheritance
Hi,
currently I do some work with polymorphic associations in egde rails
class Order < ActiveRecord::Base
belongs_to :payment, :polymorphic => true
end
class CreditCardPayment < Payment
end
class PayPalPayment < Payment
end
class Payment < ActiveRecord::Base
has_one :order, :as => :payment
# common stuff in here
end
I want to use [Payment] for common functionality
2006 Jan 17
10
Is STI the only way to do inheritance?
I''m currently coding a system which must store multiple contact methods for
a user (phone, email, postal address etc). I''m planning a fairly
straightforward inheritance hierachy for these, where each different method
inherits from something like a ContactMethod class.
The only mention of ActiveRecord support for inheritance I can find in the
Wiki and the Agile Web Dev book is
2004 Nov 19
18
SingleTableInheritance Considered Harmful
Here''s the text of a quick note I''ve added to the Inheritance wiki page.
I''m actually proposing that it would be a good idea to drop automatic
single table inheritance and force people to declare it explicitly.
There are two reasons for this:
1. Implicitly doing it unnecessarially limits your use of
inheritance where you really need it: in your object-oriented
2007 Feb 05
10
how does Mocha compare in terms of classical vs mock-based testing, and stubbing???
Hi guys,
I''ve just been reading Martin Fowler''s article re mock versus
stubbing<http://martinfowler.com/articles/mocksArentStubs.html>where
he compares traditional TDD testing techniques with mock based
testing. I''d be interested in comments from a ruby on rails perspective in
terms of this and Mocha? For example:
a) Do you see Mocha as a robust way to test Ruby
2006 Jul 02
7
Generic SingleTable inheritance
Hi all,
I would like to discuss a design idea I have in mind with you, in order
to get critical feedback.
ActiveRecord supports single table inheritance(STI) "per se", BUT you
must add all possible instance variables(properties) of all subclasses
to the "base table"(as columns). I would like to circumvent this
restriction.
Say we have a
class AbstractGenericThing <
2006 Feb 20
5
find(:all) vs find_all
I started with Ruby on Rails in the 0.13.x period, so I''m sure I
missed out on a lot of history. There''s probably some good
explanation for something I''ve been wondering about, but I haven''t
seen it written down anywhere. Maybe someone can clue me in.
I''ve always felt that one of the uglier APIs was the
ActiveRecord::find() method. I call
2006 Apr 14
5
One Controller, Many models
Hello all,
I am working on a app right now that is going to replace a paper form
process out client has. This process has quite a few forms (about 30)
and different groups of forms (section) need to be filled out based on
what information is required from the user. For example, here is a
possible process of 2 users:
user 1 user 2
Section 1 Section 1
Section 2 Section 2
2006 Apr 13
2
One model won''t work like the others, generating weird error
I''ve been banging my head against this for quite some time and can''t
figure out what is going on. I''m doing up a web site based on Typo and
adding in some custom controllers. I''m running Typo from trunk, so it''s
using the version of rails in vendor/rails. Everything is going
smoothly...until now.
I have one model that JUST. WON''T. WORK.
2006 Mar 22
1
How do you clean up this cryptic code?
So, I''m coding my school project in Rails.
There are two models, User and Restaurants.
I noticed that in Restaurants, when you use the belongs_to method, you
could specify the condition of the associated table. There are a few
types of users, in the user_type column of the users table - owners is
type 1, users are type 2.
So in my haste to hand in enough code, in the Restaurant model,
2008 May 18
2
Using Hash to mock classes that respond to :
Hi
I''ve been doing this a while now. If I have a class that responds to :
[], and all I''m interested in stubbing is that method, then instead of
using a mock I just create a hash. (Similarly, you could create an
array when you are testing an Enumerable object.)
Example from code I just worked on, where uses MigrationGraph#[] looks
up graph vertices by name:
2006 Jan 14
11
nuby: do models have to inherit directly from ActiveRecord?
Hello,
I have a few models -- book, cd, dvd -- for which I''d like to have an
abstract base superclass to hold some common stuff. That abstract class, I
was thinking, would inherit from ActiveRecord.
Didn''t work, though, and looking around, I found this:
<http://wiki.rubyonrails.com/rails/pages/HowtoMakeAbstractModel>
2006 Jan 27
2
DB & AR advise please (diagram inc)
Hi,
Being new to Rails and Active record could someone please check my
database diagram:
http://spectrais.com//images/0.png
I am building a trouble ticket system for my company. Simply put a
client has many users. Those users can create trouble tickets. Each
trouble ticket can have many journals that track the progress of the
ticket. An employee (of our company) can take ownership of a
2006 Jan 10
14
Not wishing to instigate a DB war, but...
Can I get some opinions on which free DB to use with rails for a virtual
server that will eventually be doing lots of heavy database lifting?
Not a lot of heavy duty querying per se. Think multiple simultaneous
forums and blog sites and the like.
I know each of the different DB possibilities such as MySQL and
PostgreSQL has plus points and minus points. I''m particularly
interested
2017 Jun 04
2
read.table
Hi All,
I wonder if there should be one character for quote= in read.table, i.e.,
> args(read.table)
function (file, header = FALSE, sep = "", quote = "\"'", dec = ".",
...
I have a file containing the following lines,
08248-GOTERM 3'-phosphoadenosine 5'-phosphosulfate biosynthetic process
08279-GOTERM 3'-phosphoadenosine
1998 Oct 08
3
digest...
Hi
I get this mailing-list as a digest (as everyone does, i guess). This is
quite inconvinient for answering single questions.. I every digest there is
a message with Subject: Re: Samba dingest <NR>... This makes it hard to keep
track about whath message the replay is ment for.
Another problem is, that mime-attachments don?t seem to work. This is
especially bad, because some Microsoft