dynamic-attributes Questions

3

Solved

Is there a way to set col as dynamic or convert it in some way to a valid attribute? It is currently throwing the error: undefined method `col=' for #... def copy_stock_data_from_sandbox(cntrlr) ...
Entablature asked 30/3, 2012 at 0:26

5

Solved

There is a handy dynamic attribute in active-record called find_or_create_by: Model.find_or_create_by_<attribute>(:<attribute> => "") But what if I need to find_or_create by more t...

1

Solved

I can dynamically look up object attribute values using object.__dict__[some_key] or getattr(object, some_key). Which is faster or better, and why? >>> class SomeObject: ... pass ... >...
Wardroom asked 29/12, 2012 at 18:56

4

Solved

I'm learning MongoDB through the Mongoid Ruby gem with Rails (Rails 3 beta 3), and I'm trying to come up with a way to create dynamic attributes on a model based on fields from another model, which...
Minesweeper asked 23/4, 2010 at 14:16

2

Solved

I have a model with several date attributes. I'd like to be able to set and get the values as strings. I over-rode one of the methods (bill_date) like so: def bill_date_human date = self.bill_da...
1

© 2022 - 2024 — McMap. All rights reserved.