search for: find_all_by_

Displaying 9 results from an estimated 9 matches for "find_all_by_".

Did you mean: find_all_by
2005 Dec 14
4
find_by_ issue
In the Agile RoR book, page 219 (softcover version) they talk about the fact you can use the methods: find_by_ and find_all_by_ and fill in the last piece with a valid column name. So I have a database table called "parts" and the following columns: id partname partnumber vendor I do the following: (connection to DB already established) class Part < ActiveRecord::Base end mypart = Part.find_by_partname(&...
2008 Mar 04
6
find_all_by deprecated?
Is find_all_by deprecated and/or find_first_by for 2.0.2? If not, what is actually deprecated? just find_all(..) and find_first()? Thanks for clearing this up. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
2008 Feb 07
1
ActiveRecord 'find_or_initialize_by' dynamic finder bug? Ignoring conditions.
...le ''state'' values (passive || pending_singup). While trying to implement this I discovered that the find_or_(initialize| create)_by_* dynamic finders totally and silently ignore any conditions passed. Bug? Should''nt these dynamic finders behave the same as find_by_* or find_all_by_* dynamic finders and use the :conditions passed to them? The documentation seems to indicate that they should. http://api.rubyonrails.org/classes/ActiveRecord/Base.html Dynamic attribute-based finders "It''s even possible to use all the additional parameters to find. For example, th...
2006 Apr 12
0
Select Collection with Conditions - May Help You...
...me know if you have a better, more elegant way. Still new to Rails, but was fiddling around with the Select Helper trying to return an option collection that was filtered (in other words, I didn''t want every item from the collection, just the ones that met a certain criteria). I used find_all_by_ to do it and it looks like this in my view: <% select ''deal'', ''supplier'', Client.find_all_by_is_supplier(true, :order => ''name'').collect { |c| [c.name, c.id] } %> Note the sort order as well. Hope this helps someone... Cheers, David...
2007 Dec 06
1
Testing find_by_sql
Hi all, I have a controller method that, given some parameters, constructs a big sql query and passes it to find_by_sql (with pagination). The point is that I can''t wonder how to write a functional test for this method. Has anyone passed already through this? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message
2006 Aug 16
4
Undefined method - what undefined method
I am doing a typical database list, but when I do <% for m in @private_messages %> (Line 28) It tells me that the method ''each'' is undefined. What''s wrong, I did not call the method each.... Here''s the error: Showing app/views/account/mail.rhtml where line #28 raised: undefined method `each? for #<PrivateMessage:0x408bb830> Extracted source
2013 May 28
3
AR's find_by_* limits return results. How to avoid id?
When I use find_by_name method I get LIMIT 1 result. > SELECT "users".* FROM "users" WHERE "users"."age" = 25 LIMIT 1 But the "age" column is not unique in my table and its value may repeat. So I expect that an array of records where "age" is 25 will be returned. But AR limits the query by 1. How to avoid it? Or is it the default
2006 Jul 11
6
@record.each do |record|
I''m trying to ''destroy'' a particular record of a table >From the controller side, i''ve found a list of possible records that i want deleted. ie. @chart = Chart.find(:all, :conditions => ["record_id = ?", param[''id''] ] ''id'' is passed into the controller and @chart is all the possible records that have
2008 Feb 08
4
x-post : find_or_initialize_by ActiveRecord bug? Ignores :conditions
...le ''state'' values (passive || pending_singup). While trying to implement this I discovered that the find_or_(initialize| create)_by_* dynamic finders totally and silently ignore any conditions passed. Bug? Should''nt these dynamic finders behave the same as find_by_* or find_all_by_* dynamic finders and use the :conditions passed to them? The documentation seems to indicate that they should. http://api.rubyonrails.org/classes/ActiveRecord/Base.html Dynamic attribute-based finders documentation "It''s even possible to use all the additional parameters to find. F...