I am using ActiveModels in a rails 3.1.1 project without a database backend.
I am wondering how I can set the types of attributes to String, Boolean, Decimal.
From my understanding, when using ActiveRecord backed by a database, the type would be taken directly from the database metadata. But with no database, where do I define the attribute types?
EDIT
I think my question could be asked better as, how do I add model metadata to a model that is backed by a rest or JSONRPC2 service?
For example, I could create translators that will make sure to encode that model into JSON, knowing which attribute (attribute in ruby, property in JSON) is Boolean and which is number -- or I could try to figure it out dynamically -- but it seems it would be best to have my model annotated with metadata on what type to store (in the service) these attribute/properties as.
The accepted answer still is not completely suitable. Even though Rails models do not care about types, the serialization scheme (JSON) DOES CARE ABOUT TYPES. In JSON Numbers and Boolean should not be serialized as Strings.