similar to: Through method problems with custom foreign_keys

Displaying 17 results from an estimated 17 matches similar to: "Through method problems with custom foreign_keys"

2007 Feb 04
0
Very strange observe_form problem
I am doig something very simple here and this is not working correctly. So any help is greatly appreciated. I ahve this code in my template: <% form_for :company_branch, @company_branch, :html => {:id => "company_branch_form"} do |f| %> <%= f.text_field :street1 %> <%= f.text_field :street2 %> <% end %> <%= observe_form("company_branch_form",
2006 Mar 28
2
Fastest way of adding " " around multiline text in RADRAILS
lets say i have the following SQL in my database editor : When i paste it into rad rails i have to add quotes and the ''+'' symbol to the end of each line. It is very tedious. What is the best method? select timesheets.employee, sum(items.hours) as hours, sum(items.hours*timesheets.cost) as cost, sum(items.hours*timesheets.charge*decode(activities.chargetype,0,1,0)) as charge,
2009 Sep 28
5
Multi-databases support
Hi, While I was hacking ovirt-server, I have found that it's currently restricted to Postgres DB. Even if I like postgres for serious work on a server, I really prefer to hack/dev locally on a Sqlite or MySQL DB. I have googled on rails in order to find a good answer for the "foreign key problem" which forces OVirt to stay on pg. I have found a plugin on this particular
2006 Oct 25
0
has_one & foreign_key - generating bad SQL
- MODEL - class Document < ActiveRecord::Base has_one :user, :class_name => "User", :foreign_key => "fkey", :conditions => "user = ''NAME''" end - GENERATED SQL (per the .log) - SELECT FIRST 1 * FROM table_name WHERE (table_name.fkey IS NULL AND (user_id = ''NAME'')) What I can''t figure out is
2006 Oct 27
1
has_many with nullable foreign_key?
Is there a way to use has_many and have it operate like such? select * from pages where site_id = #{id} or site_id is null I know there''s finder_sql, but then I''ll lose the find_in_collection goodness. Thanks, Joe -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the
2006 Jun 27
3
belongs_to <parent name>, :foreign_key modifier not working
All, I have two ActiveRecord objects. TargetList has_many Targets Targets belongs_to TargetList I''ve specified belongs_to :target_list, :foreign_key => ''DataSetID'' Queries generated by various methods in target_list do not seem to see the foreign_key name and keep trying to query my Target table using "target_list_id" (the default foreign
2005 Dec 22
3
foreign_key setting ignored
I''m having a spot of bother creating a ''has_many'' relationship between two legacy database tables. The relationship is ''company'' table has many linked records in the ''contact'' table. Iv''e used ''generate scaffold'' on these tables and everything is fine. I then decided to define the relationship in the
2006 Dec 07
2
Problem saving parent and children using belongs_to, class_name, and foreign_key
Hi, I have a real simple association setup here that''s just trying to: - Create a new PayjunctionOrder - Create some LineItem objects and assign them to the PayjunctionOrder - Save everything I''m using Rails Edge. ---- class PayjunctionOrder < ActiveRecord::Base has_many :line_items end ------------------ ---- class LineItem < ActiveRecord::Base belongs_to :order,
2006 Aug 13
4
has_many and foreign_key question
Alright, noob here, etc. etc. Trying to figure out the has_many usage. If I understand correctly, when you declare that a table/class has_many whatevers, the rails assumption is that there will be a foreign key in the whatevers table pointing back to the ''id'' primary key in the first table. This doesn''t seem to be the only way to have a ''has_many''
2006 Apr 07
4
STI and foreign_key problem
Hi, I am trying to use STI since my classes only vary by one column in the database. Here is the structure (names have been changed to protect the innocent): Case / \ Registered Initial \ / Children A registered case has additional information than an initial case (I realize I could just set a flag to separate them, but there is a good reason to separate
2011 Dec 12
0
yum - sqlite SIGSEVG
I've got a CentOS 6.1 x86_64 VM running atop CentOS 6.1 x86_64 KVM host. The VM is in production, so any fix needs to be fairly non-intrusive. In the VM, yum consistently segfaults when reading non-base repositories. The problem appears to be related to the faulty creation of /var/cache/yum/x86_64/<<reponame>>/primary.xml.gz.sqlite The latest installment of this problem
2006 Jul 05
7
HABTM join table has an "ID" column - is this an issue?
All, I''m building model objects for existing tables that I cannot modify. In AWDWR, Dave says "Note that our join table has no id column...The second reason for not including an id column in the join table is that AR automatically includes all columns from the join tables when accessing rows using it. If the join table included a column called id, its id would overwrite the id
2008 Jul 15
9
Beginner Question.
I''m just getting into RoR, coming from a long PHP background. So far I LOVE IT! I''m hitting a roadblock with updating my mysql database. For simplicities sake, I have 2 tables and here are the relevant columns. Table Users id name email Table Issues id createdby assignedto reportedby In my models I have everything mapped properly I believe. When I try to update the
2014 Jul 15
0
Corrupted sqlite3 astdb back end
So I found out my astdb database is boink (asterisk 1.8.something): [Jul 15 06:42:28] ERROR[18769] res_config_sqlite.c: database disk image is malformed # first stop asterisk before doing this, and do it on a copy: sqlite3 ./sqlite.db .dump |less PRAGMA foreign_keys=OFF; BEGIN TRANSACTION; /**** ERROR: (26) file is encrypted or is not a database *****/ ROLLBACK; -- due to errors (END) Anything
2013 Mar 11
0
Any interest in various features from "schema_plus" gem?
Hello (I''m new to this group so please pardon any inappropriateness), I''m a primary maintainer of the schema_plus gem<https://github.com/lomba/schema_plus/>, which adds some capabilities to rails'' schema definitions. The gem has been around for several years and is pretty reliable. I''ve been wondering whether there''d be interest in folding
2010 Aug 24
5
When should dictionary entries for the expire plugin be added/updated?
I've set up Dovecot 2.0 with the expire plugin using an SQLite DB, and when mail is delivered via dovecto-lda, the DB gets updated as expected. However, when I use Thunderbird 3.1.2 for Mac OS X to move a message to any of the folders known to the expire plugin (e.g. the 'tmp' folder), the SQLite DB is not updated. Here is an excerpt of my current configuration: #
2011 Aug 29
32
Weird assignment problem, very confused :(
Hey, I have the following line in my controller: User.create(:email => "fuuu-+RB1Aph5k6s@public.gmane.org", :password => ''asldfkjadsfadsf'', :ip => request.remote_ip) my IP is 127.0.0.1 - now User.find_by_ip(''127.0.0.1'') returns 0 records although User.first contains ''127.0.0.1'' if I change it to: User.create(:email =>