similar to: Getting my schema straightened out

Displaying 20 results from an estimated 3000 matches similar to: "Getting my schema straightened out"

2006 Jan 03
4
Set the foreign key constraint column name?
I am applying Rails to an existing schema and not sure how much the existing developers will let me go in and rename things. So I need to discover the limits of what I can change with Rails. I''ve found set_table_name and set_primary_key, which have been very useful. If I have a "foo has_one :bar" relationship, but then in the bar table my column is named "fooid"
2007 Sep 23
9
Code reviews: my dumb use of acts_as_commentable (newbie)
With the help of several heroes here yesterday I beat my way into a working solution to adding comments to one or more models in my application using acts_as_comentable. Great plugin, but my implementation is lame. I need enlightenment. I have users who log in. For several views I want to let them add comments. Enter act_as_commentable which does just this -- it''s polymorphic, so you
2013 Oct 11
1
Optimisation opportunity for IMAP searches
Hello, I love Dovecot, but when developing a small IMAP tool, I ran into searching behaviour can easily be optimised. Please forgive a rather detailed suggestion. This was on Dovecot 1.2.15 on Debian Squeeze. My tool? It's called "midget" and retrieves documents from an IMAP box based on their mid: or cid: identifier, as per RFC 2392. I thought this would be useful to retrieve
2006 Jun 07
2
Are the find_ methods strictly a SQL thing?
I''ve had a number of occasions now where I want to find something in my model that is not on the primary object. For instance I''ve got a class Alert that has_one Status. Status has a "label". I want to find all of my Alert objects and order the results alphabetically by status label. Can I do that without going into SQL? Right now I find myself doing an
2006 Feb 09
2
Polymorphic Associations
If anybody on edge familiar with this could help, that would be "great" :) I have different types of things I want to be "reviewable". So, instead of having a slew of HABTM... this new Polymorphic Associations schtick seemed like the best solution. I have everything setup as I thought it should be (so I think)... but it doesn''t appear to be working correctly. Here
2006 Feb 26
3
Rails Naming Conventions
DB field names: If I have a table that references 2 or more separate users from my users table, is there a recommended naming convention for this situation? In my case, I have 3 users associated with a record in my projects table: requester_user_id created_by updated_by I could name one of them "user_id", and then projects.user would work I guess, but wouldn''t work
2006 Apr 11
5
Multiple "has" in ActiveRecord
Please excuse a newbie question, but I couldn''t find anything by searching the archives. What I want to know is how to have multiple references to the same class/table within a class. For example, let''s say I have a table called People: create table people ( id serial8 primary key ,name); which just holds a list of the people in the database. Then I have another
2005 Dec 19
4
need some help designing my messaging system
I am trying to create a messaging system for my users but I''m having a hard time designing my db. This is what i have in mind, but I am not sure if its the best approach. user has_one inbox user has_one outbox inbox has_many messages outbox has_many messages inbox table user_id outbox table user_id messages table box_id (refers to either inbox or outbox - how?) from_id to_id
2006 Mar 14
4
has_one
I''ve got an order model that stores order data. One piece of data is a credit card type, which is a digit 1,2 or 3. I have a cardType model that has an id, shortName and LongName for the credit card merchant (visa, mastercard, amex). I want to be able to say: order.cardType.shortName, but can''t seem to get has_one working. It works with has_many and a finder_sql statement on
2011 Sep 16
4
belongs_to not working as
Hi, I have a model tests_user and score which are associated with each other by has_one and belongs_to association. class TestsUser < ActiveRecord::Base has_one :score, :foreign_key => :reg_no end class TestsUser < ActiveRecord::Base belongs_to :tests_user, :foreign_key => :reg_no end where reg_no is a unique field in both the table! score = Score.find(:first) gives me
2008 Sep 29
1
has_one :through with :source. How to alias association?
Hi to everyone, I have the following models: class Attachment < ActiveRecord::Base has_attachment :content_type => [:image, ''application/pdf''], :max_size => 3.megabytes, :path_prefix => ''../private/attachments'', :storage => :file_system, :processor => :rmagick,
2011 Oct 10
1
Text Mining with Facebook Reviews (XML and FQL)
Hello, I am trying to use XML package to download Facebook reviews in the following way: require(XML) mydata.vectors <- character(0) Qword <- URLencode('#IBM') QUERY <- paste('SELECT review_id, message, rating from review where message LIKE %',Qword,'%',sep='') Facebook_url = paste('https://api.facebook.com/method/fql.query?query=
2006 Mar 03
6
has_one :next - invalid name?
I have this in a model: has_one :next, :class_name=>''WorkPart'', :foreign_key=>''next_id'' And it causes this error: compile error /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/deprecated_associations.rb:83: void value expression
2009 Feb 26
1
XEN citrix now free but is it GPL?
Hello, Since 24 febuary, citrix xen make is enterprise version totally free: http://www.citrix.com/English/ps2/products/feature.asp?contentID=1686939 I have google about that, but no information: Is citrix will offer is source code from citrix xen server enterprise in the xen open source, or is this version is free but still copyrited? Thanks for any news about that, and sorry for my english.
2006 Apr 07
2
has_one not using the pk?
Hello, im trying to wrap a fairly ugly legacy schema using AR. How to handle normalized informations which aren''t connected via the pk? create table what ( myid int, myclass int, ;; references blahclass.blahid mygender int ) create table blahclass ( blahid int, mdesc1 text, fdesc1 text) ) I would like to wrap this as class What < AR::Base has_one :blahclass class
2006 Apr 02
7
RANT: belongs_to -> refers_to
Every once in a while, I pipe up and whine that "belongs_to" should really be ''refers_to" [http://dev.rubyonrails.org/ticket/2130]. It''s time again. I''ve got a bunch of stuff going onto eBay, so, like any good engineer, I don''t just post it manually: I design a Rails-based inventory database that creates a semantically-correct XHTML/CSS auction
2006 Jun 22
1
Sharing primary key between two tables?
Hello, I have an ActiveRecord question. I have two tables, "customers" and "users". Those two tables really should share their primary key, in order to have a "real" 1:1 relationship. (I don''t mean to start a database-resign religious war, but I must say that I do feel very uneasy about using ActiveRecord''s "normal" way, which is to
2006 Jan 13
4
Single Table Inheritance (this is my 3rd post :( )
Hi Everyone, I hope I get some feedback on my question. Here it goes. I have a situation here, I have a company table and then using Single Table inheritance it is of 3 types: class Company < ActiveRecord::Base end class Vendor < Company end class Customer < Company end class Agent < Company end Now I have a active record Association class QuoteSheet < ActiveRecord::Base
2004 Jan 26
1
RE: Bluetooth discussions (quick glance to some BT products)
There are somes products available claiming to connect a BT headset, a cell phone and a phone land line all together. I've found some : http://www.geekzone.co.nz/content.asp?contentid=2079 http://www.clipcomm.co.kr/ The clipcomm BS-A101 sample price is : $570. It's VoIP land phone that can make/receive a voice call using your CTP cell phone or BT-enabled headset. Maybe the best system
2006 Feb 09
2
Crazy @55 Inheritance
I have one table, called "people". Within this table, there are type "users", "managers".... etc. So, basic STI. Now, I want a "user" to have one manager, but a "manager" to have many "users". Since I don''t want to use HABTM... how do I set this relationship up seeing that :has_one, :belongs_to and :has_many don''t