I am trying to do this, where associated_record_type is always of the name
of a model, passed to the method:
record = eval(#{associated_record_type}).find_by_id(associated_record_id)
Is there a way to do this dynamically without using an eval?
--
You received this message because you are
On 3 May 2011 20:26, David Kahn d...@structuralartistry.com wrote:
record = eval(#{associated_record_type}).find_by_id(associated_record_id)
Is there a way to do this dynamically without using an eval?
record =
associated_record_type.classify.constantize.find_by_id(associated_record_id)
--
On 3 May 2011 20:30, Michael Pavling pavl...@gmail.com wrote:
On 3 May 2011 20:26, David Kahn d...@structuralartistry.com wrote:
record = eval(#{associated_record_type}).find_by_id(associated_record_id)
Is there a way to do this dynamically without using an eval?
record =
On Tue, May 3, 2011 at 2:33 PM, Michael Pavling pavl...@gmail.com wrote:
On 3 May 2011 20:30, Michael Pavling pavl...@gmail.com wrote:
On 3 May 2011 20:26, David Kahn d...@structuralartistry.com wrote:
record =
eval(#{associated_record_type}).find_by_id(associated_record_id)
Is there a
4 matches
Mail list logo