Displaying 4 results from an estimated 4 matches for "find_by_type".
2006 Feb 17
4
Table with Constants
...ject'', ''method'', Constants.find(:all, :select => ["key,
value"], :conditions => [''type = ?'', "sex"]) %>
I prefer to have something in the ConstantsModel to return an array like
class Constants < ActiveRecord::Base
def find_by_type (type)
find(:all, :select => ["key, value"], :conditions => [''type = ?'',
type])
end
end
Can anyone help me?
--
Posted via http://www.ruby-forum.com/.
2006 Jun 04
2
Manipulating collections
I appreciate this is basic stuff but can''t seem to find the answer
anywhere using Google. If someone could point me in the direction of
some documentation on this I would be very appreciative.
If I have a collection as follows:
@stuff = Stuff.find_by_type(''new'')
And I then want to add something onto it, how can I add to this
collection?
Additionally how could I go through the collection and say change or add
an attribute after matching certain objects?
many thanks,
Chris
--
Posted via http://www.ruby-forum.com/.
2006 Mar 03
7
Meta Programming Help
...onditions => ["product_id = ? AND
(file_type LIKE ? or file_type LIKE ?)", prod_id, "%pdf", "%msword"])
end
end
Is it possible to create one meta-method that contains the stub for
these methods? I''m NOT looking for something like:
def ProductFile::find_by_type(type, mode, prod_id)
//code snip
end
Perhaps something using the define_method feature?
2006 Jun 30
2
how to HABTM with STI ??
Hello all
This is my first post so excuse the basic question. (and any repeats I just
got an email saying this post was too big so I have re-submitted a smaller
version)
I was following the thread on
http://lists.rubyonrails.org/pipermail/rails/2006-May/038988.html regarding
the STI on HABTM for RoR.
I have a very similar problem and was hoping for some help.
I have the