similar to: Problems with ActiveRecord, Oracle adapter, find_by_sql, multi-table join - ORA-04043 error

Displaying 20 results from an estimated 800 matches similar to: "Problems with ActiveRecord, Oracle adapter, find_by_sql, multi-table join - ORA-04043 error"

2006 Nov 10
3
Move variables from session to ActiveRecord?
Buildings have units. Units have rooms. Rooms have people. I can grab building, room, and people IDs and store them in a session[:variable]. However, when creating a new unit, I need to give that session[:building_id] to ActiveRecord for creation. I''m not sure whether to use hidden fields or do it all in the model ''before_validation'' - in either case I
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
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.
2006 May 15
0
Execution expired with MONGREL. No problems with webrick
After my action has run for about 2 minutes i always get a timeout. It doesn''t happen with WEBRICK. As far as i can see there is nothing wrong with the code "execution expired RAILS_ROOT: config/.. Application Trace | Framework Trace | Full Trace /opt/tools/lib/ruby/1.8/timeout.rb:54:in `clone_attributes''
2005 Dec 23
0
Problem with large join table and ActiveRecord
Hello, I''m having a hard time explaining this, so I hope i can say this correctly. I have these tables: people id fname lname departments id name buildings id name room wtkeys id key_number key_way Issued_keys id people_id department_id building_id wtkey_id date_issued My
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'',
2011 Sep 27
0
has_many with :finder_sql returns [nil]?
Is it supposed to do that? I find it very confusing. AR 3.0.10 class Unit has_many :units, :finder_sql => proc { "SELECT * FROM `#{table_name}` WHERE `location_id`=#{id} AND `location_type`=#{Location::UNIT}" } end Both should return []. However... >> Unit.first.units.find([1000000]) [2011-09-27 10:05:11|main|debug] Unit Load (4.0ms) SELECT `units`.* FROM `units`
2006 Mar 16
4
Table Relationships Problems.
I have the following tables setup: locations :id :name systemmessages :id :name systemmessage_validtimes :id :name :systemmessage_id :location_id :start :end The systemmessage_validtimes has a ''has_many'' relationship with systemmessages, meaning that there could be many valid times for each system message. @systemMessage = Systemmessage.find(1) E.g. I
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
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
2007 Jun 08
0
Advanced search
I like the simple search of ferret; I would like to take this one step further and do an advanced search; the user will type in key words and use a drop down box to select the location; now how to pass this location_id to the ferret search so it searches key words only on matching records with same location_id? thanks -- Posted via http://www.ruby-forum.com/.
2006 Nov 04
0
one to many relationship; has_one
I''m new to ruby and rails and as a result am a bit lost on implementing a one to many relationship. In my DB I have 2 tables contents and locations, contents contains the foreign key location_id. I generated a content and a location model using rails scripts and then edited the models as follows class Content < ActiveRecord::Base has_one :location end class Location <
2007 May 31
0
Rails AR/SQLServer Unit Test: [6912] failed (but getting better)
"bitsweat" has given AR/SQLServer some love, but it''s still unhappy... http://dev.rubyonrails.org/changeset/6912 ------------------------------------------------------------------------ r6912 | bitsweat | 2007-05-31 10:15:56 -0700 (Thu, 31 May 2007) | 1 line Fix an edge case with find with a list of ids, limit, and offset. Closes #8437.
2008 Feb 25
1
NoMethodError: undefined method `<=>' for :zip:Symbol
Long time programmer, but I just started learning RoR last week. I am going through some examples in the book "Ruby on Rails: Up and Running". The example I am on had me add a table to the database that looks like so: CREATE TABLE people ( `id` int(11) NOT NULL auto_increment, `type` varchar(20) default NULL, `name` varchar(20) default NULL, `email` varchar(30) default NULL,
2005 Aug 02
0
Debugging woes
I am trying to debug this mockup, it runs fine from the shell, but when I run it from within emacs with rubydb, I get an exception. I''ve tried this in the past, running a test from within emacs and it failed. I think it has something to do with the environment. I''m not sure how I should invoke the interpreter to give ActiveRecord access to what it needs. Currently I just call it
2006 Mar 17
0
Multiple Associations, Multiple Joins
Two separate questions in this post. 1. I have a model with two foreign keys to the same table. In this case, the associations represent "categories", so I have category1_id and category2_id. Doing belongs_to :category, :foreign_key => "category1_id" works, and I can use foo.category, however when I want to access the second category, I am forced to use SQL. I realize
2009 Apr 03
0
Alpha sorting on both options and groups for option_groups_from_collection_for_select
# How would you best perform a secondary sort on :buildings below? = ''Building Name'' = select_tag ''building_id'', | option_groups_from_collection_for_select(Site.all(:order => :full_name), | :buildings, :full_name, :id, :full_name, nil) | -- Thanks, Tyler Arrigoni President OneInterface.net Network Engineering, Inc. 7475 North Palm, Suite 105, Fresno,
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
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