similar to: Table Relationships Problems.

Displaying 20 results from an estimated 100 matches similar to: "Table Relationships Problems."

2006 Jun 26
2
How can I sort options in a select box?
Pretty much a newbie here, looking for help on select boxes in forms.... Is there any way in the view to sort the options of a drop-down select box? My current code (within a larger _form.rhtml file) is: <div class="form-element"> <label for="asset_location_id">Location</label> <%= select ''asset'', ''location_id'',
2006 Aug 02
2
many-to-one relationship, do I need a second table?
Ok, to keep things short. Im wondering if I need a secondary relationship table to handle my many-to-one relationships. Here is an example of what I''ve written down. For instance say I want to find all of the people in a given location. class Location < AR:Base has_many :people end class Person < AR:Base belongs_to :location end My SQL tables look like: CREATE TABLE
2010 Dec 14
5
Build associated model confusion
I''m new to Rails3, and I''m just trying to get one last thing to work before I call it a night. The situation is the following (please if the code is horrible, just let me know, still learning): I want to log a dive. I might have a new location on that dive at which point I have to create a new Location, and then create the dive. A dive has_one location. A location has_many
2006 Jun 07
10
habtm "AND" find conditions
I have two tables and a join table for them e.g. books, authors in a many to many relationship (habtm) and a join table books_authors. I can successfully search for a book that has "author.id = 2 OR author.id = 4" but I am unable to search for "author.id = 2 AND author.id = 4" This is because the result of all the joins only has one author.id column so no single row has
2006 Dec 29
3
Functional test a "create" action when a validation fails
I''m trying to write a functional test of a "create" action in one of my controllers. In the corresponding model I have a "validates_uniqueness_of :location". In the test case I am constructing I have the create fail with the error "Location has already been taken". Is there a way I can write an assertion like: assert_equal "Location has already been
2006 Jul 07
4
How to add Asia token analyzer to ferret simply?
Hi,David Can you give me an example of how to add analyzer to ferret to Asian languages? My web application will have to support multi language search,which means,for example,both Chinese and English will be searched through the form. Currently,I have decided to use the simple token principles,which means that every Chinese character will be a token,although this is not so well in some
2011 Jun 07
1
Populating values from html
can we populate values into an excel sheet from html forms that has to be used in R for data analysis Can we directly retireve the values from html forms into R fro analysis -- View this message in context: http://r.789695.n4.nabble.com/Populating-values-from-html-tp3579215p3579215.html Sent from the R help mailing list archive at Nabble.com.
2008 Apr 23
1
Validation dependent on unsaved parent
I''m having trouble with a validation that depends on an attribute of a belongs_to parent. If the child is added to an unsaved parent (parent.children << new child), the has_many collection parent.children includes the unsaved child. However the belongs_to attribute child.parent appears to be nil until the parent has been saved. Without access to the parent attributes, the validation
2005 Jun 09
8
RDoc Dashboard Widget
Hi everyone - sorry if this is a bit OT, I''m not subscribed to the ''ruby-talk'' list, but if anyone wants to cross post this over there... This is just a quick announcement to let people know that I''ve built a basic RDoc Dashboard widget for Mac OS X Tiger. It''s still beta-ish, but seems to work okay for me - and it''s a convenient reference
2007 Jul 25
17
DRb not starting
Hi, I have my Model as follows: class Mutation < ActiveRecord::Base acts_as_ferret ({:fields => {:description=>{}, :product_id=>{:index => :untokenized}, :product_description=>{}, :product_label_description=>{}, :product_label_free=>{}, :product_product_id_supplier=>{}, :product_description_supplier=>{}, :supplier_description=>{}, :pub_date_sort
2006 May 24
4
AR foreign key problem.
Hello Railslist, (I''m using RadRails 0.6.3 on Windows XP with Ruby 1.8.4, Rails 1.1 and SQLite3) I have two tables in the database: "locations" and "customers": customers.sql --- id INT PRIMARY KEY name VARCHAR 255 address VARCHAR 255 postal_code VARCHAR 255 city VARCHAR 255 --- locations.sql --- id INT PRIMARY KEY postal_code TEXT longitude FLOAT latitude FLOAT
2008 Jun 12
1
unidirectional belongs_to polymorphic
The setup: class Location::Base < ActiveRecord::Base set_table_name :locations ... end class Location::Address < Location::Base ... end class Location::Airport < Location::Base ... end class Person < ActiveRecord::Base belongs_to :location, :polymorphic => true, :class_name => "Location::Base" ... end I want a unidirectional belongs_to relationship. That
2001 Dec 01
4
features in samba 3.alpha
now that samba3 compile in my redhat 7.2 i want to test it.. reading the documentation that described the new features supported in samba3alpha i cant find too much explanation.. and here is the quiz: now from a win9x client when i see the list of users, i can see groups for adding to my win9x clients shares?? what is the state of support of changing password from a terminal like NT SERVER
2005 Dec 12
2
count sql failing with unknown table....
Hey Rails People, I''m doing my first Rails app and I''m having a newbie problem with the count method.... Mysql::Error: #42S02Unknown table ''jobs_sectors'' in where clause: SELECT COUNT(*) FROM jobs WHERE (jobs_sectors.sector_id = 1 ) Extracted source (around line #4): 1: <div class="sectors"> 2: <ul> 3: <% for sector in @sectors
2006 Jan 27
2
Forms and one-to-one association
My models are: class Event < ActiveRecord::Base belongs_to :location class Location < ActiveRecord::Base has_one :event The view: ... <%= datetime_select ''event'', ''meet_at'', :start_year => 2006 %></p> <%= collection_select(:event, :location, @locations, :id, :name) %> .. The problem is that in the controller, when I
2005 Dec 16
3
Using :include "recursively" (including the children of the child)?
Hi, Let''s say I have the following hierarchy of tables: Group <- parent Location <- child of Group School <- child of Location Phone <- child of School Then, if I want to do this: Location.find(...someparms..., :include => [:schools, :group, :phones]) I get an association error (Association was not found). I guess it happens because AR is looking in the Location model
2009 Jul 29
9
partials...
I am getting a blank page, no errors, just a blank page. I have 2 files... reports/city_taxes_print.erb reports/_city_taxes_print.erb and my method is city_taxes_print and after getting variables from the controller, my erb file which is fairly basic... <% # City of Scottsdale @taxauthids = [ "32", "40" ] @report_title = "Scottsdale Sales Tax Detail Report for
2006 Jan 19
8
I can''t figure out how to solve this one
I am creating an application to run a fishing tournament (see http:// www.ruby-forum.com/topic/51209 for a little background) Now I am running into an issue trying to calculate a leader board. each participate can enter multiple fish but only the largest fish per a given species counts towards the overall score. My entries table looks like this:
2005 Nov 03
0
AR model and virtual attributes
i have a need to create a ''virtual'' attribute. Is the following possible? class User < ActiveRecord::Base # user things are owned by user at his selected location has_many :owned_things, :class_name => "Thing", :conditions => ''user_id = #{id} and location_id = #{location_id}'' attr_accessor :location_id end class AccountController <
2008 Jan 09
0
problem with checkboxes updating table
I''m having issues getting checkboxes to update a cross-reference table correctly. I keep seeing entries in the locations_users table, for location_id and user_id, "11" and "2", respectively. The user id is fine, but there is no such location with id 11. There are only 5 locations and their ids go from 1-5! I can''t seem to find where the 11 is coming from.