Displaying 13 results from an estimated 13 matches for "case_manager_id".
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 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 `case_manager'' for
#<#<Class:0xb7b93f84>:0xb7b93b88>
What should the collection_select statement look like for it to populate...
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...
2006 Feb 06
3
linked table confusion
...WHERE (case_managers.placement_id = 4) LIMIT 1
which makes sense in that I don''t have a ''placement_id'' column in
case_managers table. But case manager has many placments so I did create
a join table - case_managers_placements in which there are 2 fields...
placement_id
case_manager_id
and foreign keys for both fields to their respective tables
then I inserted 1 record, for the placement with the proper placement_id
and case_manager_id for the join...
I still get the above error.
How does one work through this situation?
Craig
2006 Jan 30
5
Lookup from related tables
...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 field.
I cannot figure out how to do that with either auto_complete or select
functions. This isn''t exactly covered in Agile book.
Can anyone point me to an example of how this is done?
Thanks
Craig
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 @placement.save
flash[:notice] =...
2006 Jan 26
0
selecting from dynamic pop-up list populated by a table
...or adding/editing clients as I am pretty sure that I have the
necessary things set up for relationship between the two tables.
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 `case_manager'' for
#<#<Class:0xb7b93f84>:0xb7b93b88>
What should the collection_select statement look like for it to populate...
2006 Apr 02
5
foreign keys and migrations
Hi:
I''m looking to get a point clarified which i''m sure is obvious to
everyone else but I haven''t been able to find the answer to. i''ve
tried searching through the forums and the api pages and haven''t found
anything.
Is there a way with migrations to set up foregin key relationships?
(beyond putting in the relevant foregin_id attributes)
Is
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 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 Mar 25
1
foreign keys on migration
...ADD CONSTRAINT clients_pkey
PRIMARY KEY (id)''
execute ''ALTER TABLE ONLY users ADD CONSTRAINT users_pkey PRIMARY
KEY (id)''
# set up foreign key restratints for PostgreSQL
execute ''ALTER TABLE ONLY clients ADD CONSTRAINT fk_cp_case_manager
FOREIGN KEY (case_manager_id) REFERENCES case_managers(id)''
execute ''ALTER TABLE ONLY placements ADD CONSTRAINT fk_cp_client
FOREIGN KEY (client_id) REFERENCES clients(id)''
execute ''ALTER TABLE ONLY placements ADD CONSTRAINT fk_cp_facility
FOREIGN KEY (facility_id) REFERENCES facilit...
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 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