Displaying 20 results from an estimated 2000 matches similar to: "Overide the default find_all"
2006 Jul 09
8
find_all order question
How does one properly get find_all to grab the data from the DB table
ordered by a specific column?
For example:
@anglers = Angler.find_all
This code gets all the angler records and they are sorted in order of
the id field which is of course set as a primary key in the DB (mysql).
I''d really like to pull the data from the DB sorted in the order of
another field, for example
2006 Aug 14
4
Controller method problem
Hi,
I have a def in my controller see below where i want to find the page
object based on a parameter value and then use the page_id to then find
all the contents that belong to that page in the same method.
Controller
def aboutus
@page = Page.find_by_name(params[''About Us''])
@contents = Content.find(:all,
:conditions => "page_id = #{@page.id}")
end
2005 Oct 24
3
bogus find_all in Rails 0.14.1
I have the following statement
cl = ChatEvent.find_all("ev_type <> #{t} and chat_id = #{@params
[:chat_id]} order by created_at")
which produces the following error:
#42000You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near ''order by created_at)'' at line 1: SELECT * FROM
2006 Apr 22
6
nOOb question: How to use find_all with form input data
Hello,
I''m having a problem utilizing the find_all method with a value from a
form. I keep getting the following error:
Mysql::Error: #42S22Unknown column ''category_id11'' in ''where clause'':
SELECT * FROM items WHERE (category_id11)
The controller seems to be getting the correct data, but my key and
value seem to be mashed together(it''s
2006 Jan 24
4
How to filter an activerecord find_all...
I have a nice hierarchical table structure like this:
divisions
has_many groups
groups
belongs_to division
has_many subgroups
subgroups
belongs_to group
has_many units
units
belongs_to subgroup
I have a report which is based on units, but i want to be able to filter
the units by which subgroup, or which group, or which division. I also
want to sort them by division.name,then group.name,
2006 Feb 20
5
find(:all) vs find_all
I started with Ruby on Rails in the 0.13.x period, so I''m sure I
missed out on a lot of history. There''s probably some good
explanation for something I''ve been wondering about, but I haven''t
seen it written down anywhere. Maybe someone can clue me in.
I''ve always felt that one of the uglier APIs was the
ActiveRecord::find() method. I call
2006 Jul 05
10
Scalable alternative to #find_all
Is there any scalable alternative to iterating all the records of a
certain model? #find_all seems to load everything into memory. With
500.000 records it will be a swap storm.
Pedro.
2006 Jan 26
3
global objects?
Forgive the term global if that''s not applicable in rails (i come from a
php background)
I have a browse controller with a couple of different methods
def method1
@properties = Property.find_all
#other stuff for that method
end
def method2
@properties = Property.find_all
#other stuff for that method
end
def method3
@properties = Property.find_all
#other stuff for that method
end
I
2006 Mar 22
0
Wierd hash being returned from a .find_all call (usingmySQL)
I was following a basic todo list tutorial, and when I call a:
@items = Listing.find_all
render_text @items.inspect
The following is displayed in my browser, and clues?...
[#"Don", "category"=>"Human", "id"=>"1", "hidden"=>"0"}>, #"Cheese",
"category"=>"Food",
2005 Mar 07
0
an escape from using find_all
Hi,
I''ve got a form where I change and update the @cost values, I wanted
to see a select tag showing all the clients names instead of inserting
manually the code in the textbox... to do so I''ve used
options_from_collection_for_select on another var @client (setted to
find_all on the controller calling this viewer).
<select name="client">
2006 Feb 15
3
accepting and passing args to find
I have a method that I want to accept args like the "find" method does
and I need to pass those args along to a find call.
# in controller action:
@projects = Project.find_allowed(session[:user], :order => "name")
# start of the model method:
def self.find_allowed(owner, *args)
projects = self.find_all(args)
...
No matter how I try to pass those args along I get
2006 Aug 14
2
finders et sous-classes
Bonjour, c''est ma premi?re question ici car d''habitude il me suffit de
parcourir de tels forum pour trouver r?ponse ? mes questions.
Donc cette fois, c''est du s?rieux, je n''ai pas r?ussi ? trouver la
moindre ?vocation ? mon probl?me.
Je vous explique.
J''ai une famille de mod?les :
class Attachement < ActiveRecord::Base
...
end
class Illustration
2017 Oct 18
4
Global stack on Cortex-M4
Hi all !
I just learned about the Opus codec and would like to try it out on my
NRF52 (Cortex-M4) target. I've been struggling a bit with the
"trival_example.c" setup but repeatedly run into "hard fault" crashes
when stepping through the code.
Firstly; for a "bare bone" configuration, does the following compiler
directives make sense ?
UDEFS =
2006 Apr 06
6
select method
The documentation states as an example:
select("post", "person_id", Person.find_all.collect {|p| [ p.name, p.id ] },
{ :include_blank => true }) could become:
<select name="post[person_id]">
<option></option>
<option value="1" selected="selected">David</option>
<option
2006 Jan 19
6
One Last Question for me..
And then I should be ready to roll with my project.. I have some fine
tuning of the looks to do after, but funtionality first!
This is probably a rails question.. but I''m not sure where to sign up
for the rails questions email group? (I guess I turned this into a 2
question email).
I''ll ask here and then if someone will send me the url of where I go
to sign up for the rails
2006 Mar 17
2
Temporary Model Data
I am trying to optimize some methods in my model so they don''t repeat
CPU intensive algorithms every time I call the method in the same
request/response cycle.
Eg.
================
def invitations
all_pgm_updates.find_all do |update|
update.invited?
end
end
================
I want to do something like:
================
def invitations
if @invitations.nil?
2006 Apr 15
8
Instant Rails on Win XP SP2
I am trying to run instant rails on windows xp SP2. I can get the
cookbook and typo sample sites to work with webrick but not with scgi.
When i click the start with scgi i get a blank dos window and typing
www.mycookbook.com returns
Firefox can''t establish a connection to the server at
www.mycookbook.com.
This suggests that apache is not even running even though the green
light is
2006 Jul 12
1
When to use Mutex::synchronize?
I have a simple question when to the synchronize method in the Mutex
class.
Now that backgroundrb has allow_concurrency = true there is no need
to synchronize database calls in threads.
The question I have is lets say I have a simple method in my worker
as follows:
def some_method
SomeModel.find_all each do |obj|
obj.some_count += 1
obj.save!
end
end
It accesses the database, but
2006 Jan 08
2
RoR AJAX select box update?
Hi,
I want to update a select box depending on another selected option thru
ajax.
Heres how I do it
# _form.rhtml
<select id="budget_coordinator_id" name="budget[coordinator_id]"
onchange="<%= remote_function(:update => "budget_project_number", :url
=> { :action => :get_projects }) %>">
<%=
2006 Apr 11
7
Undefined Method
Where can I define the method ''tbluser'' in this error?
NoMethodError in Tblregisteredphone#list
Showing app/views/tblregisteredphone/list.rhtml where line #23 raised:
undefined method `tbluser'' for #<Tblregisteredphone:0x375c778>
Extracted source (around line #23):
20: </font>
21: </td>
22: <td>
23: <%= link_to