similar to: one to one, but only with one table per record

Displaying 20 results from an estimated 40000 matches similar to: "one to one, but only with one table per record"

2006 Mar 31
1
many to one :through another
Since has_one :colour :through => :species isn''t supported (for some reason unknown to me), can anyone forsee any problems that the following workaround might cause (in the Photo class). has_many :artists, :through => :artist_photos has_one :artist_photo So effectively, the has_many statement gives me the through functionality I need, but the has_one restricts the program to only
2006 Jul 01
6
Sorting by an attribute on a associated table
So, I have a User has_many :profiles. The most recently dated profile is considered the current one. I need to sort these users by name, but the name attribute is a member of the associated table. Is there any easy way to do this other than with some ugly find_by_sql? Maybe a more general question - is there a common solution to sorting in Ruby? -- Posted via http://www.ruby-forum.com/.
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
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 #...
2006 May 10
12
how best to implement lookup table?
Hi all - I''d like to implement a lookup table in my app that contains some reference data, just some status codes and their descriptions. What''s the most appropriate approach according to the "rails way" of doing things? Would I just implement a has_many relationship? Let''s say these are Order status codes, would the StatusCode have many Orders? This
2006 May 12
4
default value in text field
hi, This should be really simple, but i cant seem to find the answer anywhere!! In my _form.rhtml I have the following text field, how can I define a default value? <%= text_field ''purchaseorder'', ''number'' %> -- Posted via http://www.ruby-forum.com/.
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
2006 May 25
10
One set of source code with multiple instances
Hi there, we made a PHP and Impakt2 based web content management system for schools with specific features that work really well for schools. The way I designed it was so there was one central set of source code and an empty (in terms of rows in tables) database structure. To set up a new school i had a script that basically created a new directory in /var/www and then within that, symlinked
2008 May 16
3
has_one and find_by_id issue
I have two models: testamonial photo (has_attachement) testamonial has_one photo The issue is when do this: @testamonial = Testamonial.find_all_by_id(id) I get "undefined method `photo'' for" in my browser?? BUT here is the big kicker.... If I do @testamonial = Testamonial.find(:first) everything works fine and the image is show!.. (find :all works too when I loop
2006 Jun 12
4
Modelling: A table of domains
Greetings! I''m thinking of setting up a table of "domains", consisting of the core fields id, code, name, description, and type. Users is a domain, orders is a domain, recipes is a domain, etc. Domain attributes other than those covered by the core fields will go to, say, a user_other_fields table, recipe_other_fields, etc. I see the advantage of having all
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 Aug 30
1
Single Table Inheritance with self-referential join
Please tell me if this train of thinking makes sense, I need help on solving this association model problem: I am doing an app that creates and manages stereoscopic images, one stereoscopic image is formed by two photos, say photo1 and photo2 The user uploads photo1 and then photo2 and gets a preview if he likes the preview he/she authorizes it and gets a final stereoscopic image All this
2006 Apr 16
8
"Cannot convert String to Integer" after using association
So, I''ve written a partial that does some stuff with a given instance of my class "entity". Entity is ActiveRecord. I''m able to retrieve all sorts of data from an @entity, until I do something like: <% for @attribute in @entity.attributes %> <div id="attribute_<%= @attribute.id %>"> <%= render(:partial =>
2006 Jun 12
5
Method in Model
I have a simple method in a model, to send out e-mails via the script/runner. def Reminder.dropoff @messages = Reminder.find(:all, :conditions => [ "time < now()"]) @messages.each do |mes| Mailman::deliver_send_message(mes) end end However, it''s not sending e-mails. When this exact code was dropped in a controller, it worked great... is there
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 May 02
9
Visual Migration Design Tool
For a really long time, I''ve been using DBDesigner from FabForce.net. For those of your who''ve never used it, its a freeware visual entity-relationship diagram tool, which allows you to make database designs visually instead of in SQL DDL. You can then use it to generate the SQL to make your databse design into reality, or even run a "synchronize" to make any
2006 Jun 10
8
OT: Good virtual server host with debian?
Hey all, I''m casually shopping around for a host that will give me a virtual server running Debian. It would host some of my rails projects and probably some svn. Does anyone know of a good host? Anecdotes about satisfaction would be nice. Thanks, Bryan -- Posted via http://www.ruby-forum.com/.
2006 May 10
12
Strange Behavior on Non-Index Pages
If I browse to \myRoRApp, I get the "Welcome aboard" screen. I''ve done the ruby scripts/generate controller MyTest, and "Rolling with Ruby on Rails" tells me I should be able to browse to \myRoRApp\MyTest and see an error page, but what I''m actually seeing is a fastcgi config file! I have installed fastcgi, but apache can''t "see" the
2006 Jul 30
3
ActiveRecord - Multiple Address for a single record
I''m trying to figure out the Rails way to model the following problem: I have 2 tables. One (let''s call it location) contains a single address. The other (let''s call it company) contains 3 address. I''m trying to figure out the best way to model this. I''ve created an address table, a set up the model as follows: class Address <
2011 May 20
4
Unable to figure out why a photo attribute of the paperclip plugin is not being passed in as a param
Hello all, I am trying to implement a feature in my app where a user posts a message along with an image. This is something similar to what is there in `www.diasp.org` . I dealing with a pretty much outdated configuration of Rails 2.0.2 and Ruby 1.8.7 , both running on Ubuntu 10.04 OS for project specific purposes. Initially, I found a problem in finding an appropriate plugin for paperclip