Displaying 20 results from an estimated 60000 matches similar to: "apply more than one condition to a find(:all"
2006 Jun 01
4
can''t convert Fixnum into String ??
I have been getting this error message on various pages, just wondering
if anyone could explain whats going wrong, and the best way to correct
it
code that is cuasing the problem is below
@project = Project.find(:first, :conditions => "id = " +
@purchaseorder.project_id)
--
Posted via http://www.ruby-forum.com/.
2006 Apr 28
7
acts as drop down
Hi
Im using the acts as drop down plugin
and have this code below
acts_as_dropdown :text => "forename", :order => "forename"
It currently makes use of the forename in the option tag, how can I get
it to use the surname as well
ie somthing like ''forename'' . ''surname'' in php
Thanks
--
Posted via http://www.ruby-forum.com/.
2006 May 08
4
set forign key
hi,
got a small problem below and not to sure how to overcome this using
rails
two tables involved with this projects and quotes
each project has a field quote_id as a forign field.
When a user is ready to upload a quote they are linked to quotes/new
from the show project page. Once the quote is uploaded how can I then
set the quote_id field with the correct key?
--
Posted via
2006 May 10
2
gain value from form
I have the following form
<%= start_form_tag :action => ''rejectQuoteSave'', :id => @project %>
<p><label for="offer_reason_rejected"><span class="required">*
</span>Reason</label><br/>
<%= text_area ''offer'', ''reason_rejected'' %></p>
<%= submit_tag
2006 Apr 28
3
store user id in session or find user id
Hi
Im uisng the lgoin generatior that as far as I can tell stores the
username in session.
I have another table that i need to store the id of the user who creates
an entry. (the logged in user)
Is it possible to store return the id and store it in session once the
user is created.
then do somthing like @project.user_id = session[:user].id;
or can I perform a search in the product table
2006 Apr 11
9
rails equivalent to asp''s Application object?
In asp you have an Application built-in object, which works just like
the Session hash, but it lets you share information among all users of a
given application.
which is the rails equivalent???
and if there isn''t, how would you implement such a thing ? (there would
be concurrency issues to take into account, in fact asp''s application
object has some lock and unlock methods
2006 May 22
4
use join table in paginate
How come I allways immediately run into difficult stuff when I''m trying
some new programming language? Am I blind for the simplicity of
Ruby/Rail, which a see must be there? Anyway, don''t try and answer this
rhetoric question. I have got another one for you, seemingly difficult.
I''m struggling with a n:m relationship (in a database, that is) and its
join table.
2006 Apr 14
6
Running through results of find()
Hi,
I''ve got a question about the find() method in RoR
This is my code:
actions=Action.find(:all, :conditions => "ActivityID=''actid''")
This should return a list, array, hash, ... ? of Actions.
What type of data does find() return? And how do I run through it?
I would like to show Action.ActionCode for every action in actions.
I tried:
for action in
2005 Nov 22
11
Building a conditions clause (for find) of multiple optional params?
I want to be able to find items according to various params - category_id, member_id, type_id,
rating, etc. What I have now is something like:
if(@params[''category_id''])
@items=Item.find(:all, :conditions=>["category_id=?", @params[''category_id''])
elsif(@params[''category_id''] and @params[''member_id''])
2010 Oct 22
2
If Statement with more than one condition
I'm unable to find the OR operator like other language .. any suggestions?
I want to do If (condition1 OR condition 2){ do something }
Thanks for answering this elementary question.
[[alternative HTML version deleted]]
2006 Nov 29
5
AR, find(:all), loops and memory usage
I''m a beginning programming using ActiveRecord outside of Rails to do
conditional processing of database records. So far, I''ve been
successful. However, my script loads all matching records into memory
first. There are hundreds of thousands of matching records so the
script quickly consumes over 500MB of RAM before any processing is
done. Is there a way to avoid this preloading
2006 Dec 18
2
Find, paginate, conditions and associations
Hi, I''m trying to figure out how to use paginate when one of the
conditions depends on the association between one model and another.
For example: I have a model Authors which has_many Posts. I would like
to find all the authors and order them by the number of posts that they
have published and then paginate those results.
What if I wanted to base the paginate condition on all the
2006 Jun 07
10
habtm "AND" find conditions
I have two tables and a join table for them
e.g. books, authors in a many to many relationship (habtm) and a join
table books_authors.
I can successfully search for a book that has
"author.id = 2 OR author.id = 4"
but I am unable to search for
"author.id = 2 AND author.id = 4"
This is because the result of all the joins only has one author.id
column so no single row has
2009 Apr 29
2
if condition doesn't evaluate to True/False
Hi friends,
Please help me with this bug.
*Bug in my code:*
In this variable sub_grp_whr_cls_data[sbgrp_no,1] I store the where
clause.every sub group has a where condition linked with it.
Database1
Where clause was not found for a particular subgroup,
sub_grp_whr_cls_data[sbgrp_no,1] value was NULL
So the condition (*sub_grp_whr_cls_data[sbgrp_no,1]=="NULL" ||
2006 Apr 07
22
Find WHERE in Rails
I''d like to find all records that have a certain integer as their
"level" field in the database. I know how to find all the records:
allquestions = Question.find(:all)
...and I know how to find the one record that has a certain id:
allquestions = Question.find(params[:id])
...but how do you find all the records that share a certain value in one
of their fields? I tried
2012 Jul 15
4
Imposing more than one condition to if
Hi,
I have a dataset which contains several time records for a number of days, plus a variable (light) that allows to determine night time (lihgt= 0) and daytime (light> 0). I need to obtain get dusk time and dawn time for each day and place them in two columns.
This is the starting point (d):
day time light
1 1 20
1 12 10
1 11 6
1 9 0
1 6 0
2004 May 25
8
"Glare" condition - How well does asterisk handle?
Hi-
I have an upcoming application that requires use of PRI channels that are
primarily used for high-volume incoming traffic, but that are to be used for
outbound calling as well. Of course, one option is to have dedicated
outbound channels reserved, but this is an inefficient use of channel
resources.
Normally PBX's are designed to have the CPE yield to an incoming call if a
particular
2006 Mar 31
6
Lighty+Mongrel: More than one connection per client?
I have an action which requests another URL from the same site (for
testing purposes), but it keeps timing out. If I use an off-site URL,
the action works fine. I also notice that I''m only able to request one
page at a time from my server - the rest just spin until the previous
requests complete. Is this some setting in Lighty, Mongrel, or my
browser (Firefox - I played around with
2006 Jun 05
2
Pagination, how to in rails?
Hi,
Im creating a few reports for a system using ind_by_sql
Are there any built in features that I can use to paginate the results
and how can this be achived?
Thanks
--
Posted via http://www.ruby-forum.com/.
2006 May 09
2
retrieve previous id
Hi,
I have this piece of code,
if @quote.save
flash[:notice] = ''Quote was successfully created.''
#return id of preiously inserted quote
#enter this id in the correct related project field
redirect_to :action => ''list''
end
How can I return the id of the saved data?
--
Posted via http://www.ruby-forum.com/.