Displaying 20 results from an estimated 6000 matches similar to: "compound conditions in find"
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 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 Feb 23
4
looping
I have a form that prints fine for one particular criteria...
facility_id = "X"
controller code looks like this...
def fac_log
@facility = Facility.find(params[:report][:facility_id])
@placement = Placement.find(:all,
:conditions => [ "facility_id = ? and discharge_date IS NULL,
params[:report][:facility_id] ]
)
end
I can print out the form
2006 Mar 10
6
boolean select problem
I want to use select form elements to choose between boolean options. How
can I have it default to true and still display the persisted value (either
true or false) when editing an existing object? I guess booleans default to
false by default so its not obvious how to recognize when it''s a real
''false'' that the user set or default false because the value was null.
2006 Feb 07
11
breaking down a list view
I''m trying to figure out how to change the order of a list view and it''s
obvious to me that I don''t understand what I get from a simple scaffold
to know enough to alter it.
If someone would be so kind to tell me what this means ...
def list
@placment_pages, @placements = paginate :placements, :per_page => 10
end
@placement_pages, # I am guessing that this
2006 Feb 19
8
building multiple find conditions
I am trying to allow for AND type ''find'' but to allow for simply a
single set of find criteria.
controller code...
@vw_string = @vw_string1 = @vw_string2 = @vw_string3 = []
if params[:beg_intake_date] != "" then
@vw_string1 = ["intake_date between ? and ?",
params[:beg_intake_date], params[:end_intake_date] ]
end
if
2006 Feb 19
2
progressive updates
I have a list view and have it sorting the data presented in the list
view by clicking on the top of the column - that works fine.
Now, I want to add a pop up-list which controls 3 different levels of
record select to be presented in this list...
- ALL
- placement.discharge_date IS NULL
- placement.discharge_date IS NOT NULL
I can have 3 different ''methods'' and
2011 Feb 22
1
collapsing by a key in a compound database
Hello all.
I have a problem with collapsing by a key in a compound database. I have
2 databases (e.g. clients and client branches), both of them have the
same attribute (with the same valueno), `client_id'.
What I need is to search in both these databases and collapse results by
`client_id' to get client IDs (set_collapse_key is used with
collapse_max=1).
The problem is that I receive 2
2006 Feb 06
2
basic usage confusion
I am confused. Looking at ''list'' from scaffold, I see a record and click
the ''show'' button. I put in a ''link'' at the bottom of ''show.rhtml'' to my
''view'' rfn2.rhtml - action = ''rfn2'', :id = @placement
I click this link and get error...
log/development.log
Processing
2006 Mar 14
2
autocomplete using other models
I''ve asked this in various ways but I can''t seem to get much traction -
my guess is because not many people are doing this.
I am working in a controller/views called placements. Placements
belongs_to :client
I have a clients model/table - clients has_many :placements
in placements/find...this works fine...
<%= text_field_with_auto_complete :placement, :clwholename, {} %>
2006 Feb 07
7
select list error - following Agile guide
I would swear that I am tracking exactly the method used in Agile
book...
TypeError in Placements#edit
Showing app/views/placements/_form.rhtml where line #33 raised:
wrong argument type String (expected Module)
Extracted source (around line #33):
30: <tr>
31: <td><label for "type">Type</label></br><%=
32: options = [["Select
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 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 Feb 09
17
complicated finds are eating my sole
I abandoned ruby way for find_by_sql and still can''t get this...
@myplacement = Placement.find_by_sql(
"select * from placement where
:intake_date >= beg_intake_date
and
:intake_date <= end_intake_date")
just a simple date range...it''s killing me - If I knew how to load
placement controller into irb, I could probably try out finds
interactive mode...
Thanks
2006 Feb 14
8
routing failures
probably something really simple but I don''t understand.
Shifting to Apache to w/ fastcgi (definitely feels faster than webrick)
Anyway, I set the default route in routes.rb to be
map.connect '''', :controller => "placements", :action => ''list''
which worked once I figured out apache...
Anyway, now that I have done that, all attempts
2006 Mar 16
32
iterating a partial with :collection
following AWDWR book - ''Partials and Collections'' (rather sparse info
there too) and I might add that the wiki page on this topic is entirely
devoid of any info...be that as it may...
I have hash of several arrays that I want to iterate though and display.
the first hashed element looks like this (greatly simplified)
- :facility: !ruby/object:Facility
attributes:
2006 Feb 23
3
rake error
I installed at least one gem since I thought I actually once was able to
run ''rake appdoc'' command since there is an api for my models and the
ez_where plugin that I installed earlier. I wanted to see the api for
pdf-writer which is the gem that I installed most recently.
(no, I haven''t given up the issue of ''looping'' that Kevin and some
others replied
2006 Feb 10
14
dynarch calendar and calendar helper usage
I am playing around with this and reference this wiki from RonR site...
http://wiki.rubyonrails.org/rails/pages/CalendarHelper
The error I am getting is:
NameError in Placements#list
undefined local variable or method `date_format'' for
#<PlacementsController:0xb78f9ef4>
RAILS_ROOT: script/../config/..
Application Trace | Framework Trace | Full Trace
2005 Dec 29
3
Post problem with select lists
hey,
i have this problem
how come i always get -1 for the select list??
rhtml
First, select a client.
<select id="client_id" name="client[id]" onChange="submit();" >
<%= options_for_select(@client_options, @client_id.to_i) %>
</select><%= @client_id %>
controller
if @request.post?
if @request.xml_http_request? #called by ajax,
2006 Jan 25
7
join fields for list views
I am sitting with the Agile book on my desk and scratching my head at
the discussion on aggregation - perhaps that isn''t what I need.
I have a db called clients.
fields include - first_name middle_initial last_name
I want to combine them all into one name element in a list view. I can
add/edit the fields separately but in the list view, I only want the one
combo field.
Is there a