similar to: foreign keys and migrations

Displaying 20 results from an estimated 1200 matches similar to: "foreign keys and migrations"

2006 Mar 25
1
foreign keys on migration
I have reached a development plateau and now want to integrate some of the rails niceties that I passed over to get the system online. I am fooling with migrations. I am using postgresql. I put in my migration script (at the end of the ''up'' method, the following raw sql code... # set up primary key restratints for PostgreSQL execute ''ALTER TABLE ONLY
2006 Jan 25
2
select list generated from table
Have 2 tables - clients & case_managers class Client < ActiveRecord::Base has_one :case_manager end app/views/clients/_form.html contains line... <p><% collection_select("client", "case_manager_id", \ case_manager.find_all, "name", "id") %></p> and this line generates error... undefined local variable or method
2006 Feb 06
3
linked table confusion
placement.rb has_one :client has_one :case_manager client.rb belongs_to :case_manager has_many :placements case_manager.rb has_many :clients has_many :placements I am trying to create a view file for placements. I can pull columns from clients table in this view by using... <%= @placement.client.wholename %> but if I use <% @placement.case_manager.wholename %>
2006 Jan 30
5
Lookup from related tables
I have been working on this for 3 days and haven''t been able to solve it. I have 2 tables... clients belongs_to: case_managers case_managers has_many: clients When entering new clients, I need to have some type of select box that allows me to pick the case_manager (by name) so that the ''id'' field from the case_manager table is inserted into clients.case_manager_id
2006 Jan 30
3
general questions
Agile book lacks some basic information, perhaps I need to learn ruby as I am lacking information - some basic things - especially debugging. The following are stupid newbie questions and any portion of them answered would be great. 1. If I am viewing a page from app/views/clients/ and on this page, I want to put a ''link_to'' directive to say app/views/case_managers... how do I
2006 Jan 28
1
finishing a lookup value
I have a form...2 tables and using auto_complete table clients id case_manager_id foreign key case_manager_id to case_manager(id) table case_manager id name my app/views/clients/_form.rhtml includes which works (finally!) <%= text_area_auto_complete_for :case_manager :name %> and now in clients_controller.rb def create @client = Client.new(params[:client]) I need to add a line to
2006 Feb 08
7
DRY methodology
because I am a grasshopper... Now that I can sort my ''list''...is there a logical way of not repeating myself to having essentially the same list view with multiple sorts? i.e. def list_cl # ordered by clients last name @placement_pages, @placements = paginate( :placements, :include => [:client], :order_by =>
2006 Feb 21
8
Validations continued
I simply can''t figure this out. I have been reading and re-reading Agile book and wiki.rubyonrails.org - all sorts of validation methods and still, it doesn''t work. Controller code def create @client = Client.new(params[:client]) if @client.save! flash[:notice] = ''Client was successfully created.'' redirect_to :action =>
2006 Jan 25
17
Lookup pattern in Ruby
Hi folks, I''m curious how a lookup with a large group of values would be handled in Rails. For example, I have a (contrived) AnimalType filtering a list of many Animals--more than can be presented comfortably in a dropdown box. Therefore I need to either redirect to another screen to select an animal (returning after the selection is made), or show a dialog--modal or otherwise--to
2006 Apr 15
6
view code regular expression
I''m lost on regular expressions to begin with... I''m trying to fix a value to one of 4 radio buttons as there will be value of either 1,2,3 or 4 in @roles_users... <TD><input type="radio" id="roles" name="case_managers[case_manager_name]" value="Case Manager Admin" <% if =~ @roles_users /1/ checked =
2006 Jan 26
0
selecting from dynamic pop-up list populated by a table
I''ll try again... I am looking at this page...HowToUseFormOptionHelpers http://wiki.rubyonrails.org/rails/pages/HowtoUseFormOptionHelpers perhaps I should be using Ajax for this...I haven''t looked at Ajax yet. Have 2 tables - clients & case_managers I want the data from a column in case_managers to be the select list on a screen for adding/editing clients as I am pretty
2006 Feb 13
8
postgres and rake
am in a bit of a quandry... I have asked postgresql-users list and haven''t gotten anything to work with... > > How do I change the owner of a schema? > > > > ALTER SCHEMA "public" OWNER to "some_user"; #? > > http://www.postgresql.org/docs/current/interactive/sql-alterschema.html > > The docs explain this very situation. HTML
2006 Feb 03
9
Because I''m very slow - trying to use console
I can''t see how to use variables so I am using console to test things out... clients table - a column named first_name My very brief console session... >> clients = Client.find_by_sql("select * from clients where first_name = FN") ActiveRecord::StatementInvalid: RuntimeError: ERROR C42703 Mcolumn "fn" does not exist Fparse_expr.c L1034
2006 Sep 03
1
Emails corrupted...
Hi All, I have just setup a Dovecot Imap server on a Ubuntu 6.06 Lamp box. Basically I use fetchmail to retrieve emails from foregin pop accounts and then procmail transfers emails for /var/mail/username to ~/Maildir/new and other folders. Everything works fine *except* if my Thunderbird client is connected (I haven't tried any other client). If an email is received while TB is connected,
2006 Feb 07
0
second table column data lift
have placements, clients and case_managers tables with relationships Trying to create new placement record...case_manager_id field exists in clients table. I need the value from related clients record in placements table in placements_controller.rb def create @placement = Placment.new(params[:placement]) case_manager_id = Client.case_manager_id # this doesn''t work if
2006 May 24
4
pdf on the fly
In my rails app I need to create pdf reports on the fly. I have installed railspdf, wich is working fine. But, how can I create tables and paragraphs and stuff? Can I mimic an .rhtml file (using <% for ...%> etc? Or is it wise to use Ruby::PDF directly? Is there anyone out there with experience in this, and who is willing to share his findings? Thx -- Posted via
2008 Jun 05
23
unit test question
In development and production, I''ve got postgresql constraints that prevent deleting a CaseManager if there is a Client that belongs to that CaseManager. In unit tests...and obviously in my testing db, those restrictions don''t get added. Is it wrong to test for deleting dependent records in unit tests? Craig --~--~---------~--~----~------------~-------~--~----~ You received
2006 Mar 16
6
How to have multiple fields appear in collection_select?
I have a table of employees with the fields "last_name" and "first_name". I would like to populate a collection select so that what the user sees in the drop-down is "Last Name, First Name". So far, the only way I have figured out to do this is by using "find_by_sql" in my model, like so: @employees.find_by_sql("SELECT id, concat(last_name,
2006 Feb 04
1
Specifying multiple foreign keys to another table?
Hi, By convention, if I have a field that is a reference to another record in the `users` table, all I would need to do is to name the column `user_id` and RoR would know it is a reference. However currently I am working on a table that records `actions` that both impact on another user, with each action performed by another user. Thus I''d have 2 columns like `impacted_user_id` and
2009 May 27
1
Multivariate Transformations
Hello folks, many multivariate anayses (e.g., structural equation modeling) require multivariate normal distributions. Real data, however, most often significantly depart from the multinormal distribution. Some researchers (e.g., Yuan et al., 2000) have proposed a multivariate transformation of the variables. Can you tell me, if and how such a transformation can be handeled in R? Thanks in