Displaying 14 results from an estimated 14 matches similar to: "sql logic is killing me"
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 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
2007 Oct 25
1
find - group - postgres
I am not sure that this is entirely a rails question as I am trying to
run the command in postgres and I am getting the same error...
controller code...
@client_slot_count = ClientSlotsDaily.find(:all,
:conditions => ["created_at > ? AND created_at < ? AND
facility_id = ? AND client_id IS NOT NULL",
starting_date, ending_date, @facility.id],
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:
2012 Apr 23
1
Searching and returning arrays
im a begginer in RoR and am using rails 3.2.3 and ruby 1.8.7
This forum has helped me to progress but I''m confused by one thing.
My app is supposed to allow seaching for results depending on the check
boxes that are checked. In my case, when the user checks a determined
facility and clicks "search" the corresponding hotels with only those
facilities should be returned. I can
2006 Feb 28
2
sorting collection lists
I''m using collection.select lists and I would love to sort them by one
or two of the columns as the lists are getting long enough to make a
difference.
<%= options = [[''Select a Facility'', '''']] + @facility.collect {
|fac| [fac.name, fac.id] }
select ''placement'', ''facility_id'', options %>
2006 May 17
5
select list
I''m trying to build a selection list which I have done in various ways
but this one is new to me.
I have a ''facilities'' table which has all the outpatient facilities but
I need to add ''Float'' and ''Main Office'' which I don''t want to add to the
''facilities'' table itself.
so I figure I can add these to an
2006 Mar 07
6
form_tag - directing to new target window
How do I use...
<%= link_to "All Facilities", :action => ''fac_log_all'' %>
if I add :target => "_new" that is just a parameter and not a
directive.
I just want reports to print into a separate window. How do I do that?
It''s not clear at all to me
Craig
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 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 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 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 07
0
trying to order a list view
I''m trying to order a list view which contains elements from related
tables and wanting to use columns from the related tables to create the
order.
The error...
NoMethodError in Placements#list
You have a nil object when you didn''t expect it!
The error occured while evaluating nil.facility
The code...
placements_controller.rb
def list
@client = Client.find(:all)
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