Postgres and Grape::Entities: Decimals appear as strings

Sometimes grape-entity needs a little help figuring out the correct data type for model attributes. Take the following example, when using PostgreSQL as the backing DB :cost is returned as a (string)”10.5″ instead of the (float)10.5. Although you could handle this fairly quickly on the UI side (new Number() comes to mind) it’s better to […]

Rails: ParamsWrapper

Recently I stumbled onto the ParamsWrapper system inside of Rails. It’s a convenient system that allows form data to be submitted without specifying the root object. For example, if you are creating a new post you can specify the name using either name=”name” or name=”post[name]”. Either way you can access the attribute using params[:post][:name]. Most […]