similar to: newbie question: one to one relationships in ROR

Displaying 20 results from an estimated 10000 matches similar to: "newbie question: one to one relationships in ROR"

2006 Jun 06
1
Please Help with single table inheritance relationships
I''ve been searching the web, wikis, and more, and I haven''t turned up examples of how to have multiple entities in a single-table inheritance related to anything. I have an addresses table, but multiple entities can have Addresses: both Person (which has 2 addresses) and Retailer. I''ve been told that I need to use single-table inheritance, and this was my attempt:
2009 Oct 08
6
Eager Loading a Relationship That Has No PK/FK
I''m attempting to wrestle an old DB into Rails. This relationship is giving me trouble: class Show < AR::Base has_many :segments end class Segment < AR::Base belongs_to :show has_one :media #this has no PK/FK relation end A Segment is "linked" to Media by Media.name, which is the result of concatenating Segment.name and Segment.part. As I said there are is no
2006 Jul 18
2
newbie help re: loading data and relationships in migrations
Hi folks, I''m new to Ruby & Rails, and have been reading the Agile Web dev & Pickaxe books with much joy! However, I need some guidance re: using migrations to load in data for tables that have relationships. For example, I have one products table and one product_photos table (defined in separate migration files). The second table has a foreign key associated with the
2006 Jun 01
1
find not working properly
here is the input view [code] <form method="post" action="found"> <br> <b>Find by</b><br/> <b>Vehicle Number:</b><br/> <input id="truck_vehicleID" name="truck[vehicleID]" size="20" type="number" value=""/><br/> </p> <%= link_to "Find", :action
2007 Jan 19
0
Do transactions fail with polymorphic has_one relationships?
I have an AR::Base descendant with a complex object graph beneath it, like so: ArtisanQuoteInput has_one QuoteInput and then QuoteInput has several objects attached to it. Note that the relationship between ArtisanQuoteInput and QuoteInput is polymorphic, so the relationship in A is written has_one :quote_input, :as => :program_quote_input If @artisan_quote_input is an instance of
2005 Jul 25
2
acts_as_tree and traversing parent/child relationships
I am working on an Rails application that uses a pretty complex category structure through out the site. I have defined a table to house all the info and a FK to reference parents within the table CREATE TABLE categories ( id int(11) NOT NULL auto_increment, name varchar(50) NOT NULL, parent_id int(11) default NULL, constraint fk_category_id foreign key (category_id) references
2006 Jun 03
8
confused about ActiveRecord relationships
I am very confused about where to put the belongs_to and the has_one (and other relationship identifiers). I have read the RDoc and the agile book many times about this and I think i still see it backwards. Let me outline my app so you have an understanding... I have 2 tables: Schools { id, school_name, address_id } and Addresses { street1, street2, city, state, zip, country } *** this
2006 Aug 16
0
2 models with multiple relationships
I am in the middle of building YARELS (Yet Another Real Estate Listing Site), and here is one of my issues with model relationships. I have to core models and DB tables: User Property Here are the relationships I need to express: A user can have many properties that he owns (he is the seller) A user can have many properties on his favorites list (he is a buyer/seeker) A user can have many
2006 May 30
3
Help about CMS - newbie in RoR
Hi team, I''m a very newbie RoR user from Spain and I''m developing a blog''s CMS. Why RoR?, coz I think it''s an amazing framework with many posibilities, portable and really powerful, with a young and optimist community, and taking my project I''ve prefered his structure in front of LAMP. Another thing is that I''ve liked to surprise my masters
2006 Aug 06
1
Sorting through relationships
Hi, I''m having a rather annoying problem which can only be explained with an example, so here we go. I have a Person class which has_many :assets. An Asset has_one :game. I would like every Person''s asset to be sorted by its game''s title, similar to this: has_many :assets, :order => ''game.title'' That doesn''t seem to work. A
2010 Mar 24
1
How to stub a has_many relationship in Rails 2.3.5
We have a test that has been working find until we upgraded to rails 2.3.5. I''m not too familiar with mocks/stubs so maybe there is an easy solution. Here is a simple example of our scenario. Class Person < ActiveRecord::Base has_many :aliases, :dependent => :nullify before_destroy :mark_aliases_as_deleted def mark_aliases_as_deleted self.aliases.each do
2006 Jul 07
0
has_many relation handling
Hello, please have a look at this: My tables: create_table :languages do |t| t.column :name, :string, :limit => 3 t.column :title, :string, :limit => 30 end create_table :categories do |t| t.column :category_id, :integer (3.) t.column :created_at, :timestamp t.column :updated_at, :timestamp end create_table :categorytranslations, :id
2008 Jan 21
6
Rspec 1.1.2 on Windows
I am using Rspec 1.1.2 on Windows XP SP2 I am receiving the following error when I run ''rake spec'' from a brand new project: C:/SVN_Projects/rspec/vendor/plugins/rspec/lib/spec/runner/options.rb:107:in `colour='': You must gem install win32console to use colour on Windows (RuntimeError) I have the win32console gem installed and the error still occurs. It seems that the
2004 Sep 14
1
R-2.0.0 CMD check . and datasets
Hello everyone I'm having a little difficulty with R-2.0.0 CMD check. My field is Bayesian calibration of computer models. The problem is that I have a large collection of toy datasets, that in R-1.9.1 were specified with lines like this: x.toy <- 1:6 y.toy <- computer.model(x.toy) z.toy <- reality(x.toy) in file ./data/toys.R ; functions computer.model() and reality() are
2004 Sep 14
1
R-2.0.0 CMD check . and datasets
Hello everyone I'm having a little difficulty with R-2.0.0 CMD check. My field is Bayesian calibration of computer models. The problem is that I have a large collection of toy datasets, that in R-1.9.1 were specified with lines like this: x.toy <- 1:6 y.toy <- computer.model(x.toy) z.toy <- reality(x.toy) in file ./data/toys.R ; functions computer.model() and reality() are
2006 Apr 13
4
Creating an environment for a function.
I am trying to build a function in a context where the environment concept would appear to be useful. But I'm a bit foggy about this concept and would appreciate some pointers and advice. Basically the function I'm building, say foo(x,t), is a function of two variables). Depending on the value of t, foo will return one of the values f1(x), f2(x), ..., fk(x), where each of f1, ..., fk is
2011 Nov 24
0
legacy MTI schema
Hi all, In a legacy ''immutable'' schema I have MTI inheritance setting: <<TABLE systems>> id<<PK>> ( NOT database generated) installation_date manufacturer serial_number <<TABLE lifters>> id<<PK>><<FK>> ( NOT database generated ) max_weight drive In my model I have implemented the semantic of inheritance between
2009 May 26
3
Still can't find missing data
I'm trying to prepare some cross tabs, looking at a number of variables against a variable "connector" which has 2 values: "OD Passenger" and " Connector". When I produce a xtabs one way I have observations under "Connector" but against a different variable "Connector" shows all 0 values. What is wrong? I've looked into the na commands
2009 Jun 03
1
Still can't find missing data - How do I get NA in xtabs with factors?
The problem here is Table doesn't seem to have a way to weigh the data. > ToyData Data1 Data2 Data3 Weight 101 Sam Red Banana 1.1 102 Sam Green Banana 2.1 103 Sam Blue Orange 2.1 104 Fred Red Orange 2.1 105 Fred Green Guava 2.1 106 Fred Blue Guava 2.1 107 <NA> Red Pear 50.1 108 <NA> Green Pear 50.1 109 <NA> Blue
2006 Jun 12
0
table relationships
is it correct that even if the database doesn''t support or tables were not configured for Foreign Keys and / constrants , that you can still manage the relations using Rails, using model methods like, "belong_to", "has_one", and "has_many"? TIA Stuart -------------- next part -------------- An HTML attachment was scrubbed... URL: