@sgrif Where can I find a list of symbols to pass to ActiveRecord::Base.attribute to specify the type? Thanks! #confused #documentation
-
-
Replying to @ravinggenius
Working on improving documentation in that area but https://github.com/rails/rails/blob/master/activemodel/lib/active_model/type.rb#L46-L57 … are the primitives
1 reply 0 retweets 0 likes -
Replying to @sgrif
Perfect! That's exactly what I was looking for! Thanks for exposing the attributes API: now I don't feel so dirty using it. :)
3 replies 0 retweets 0 likes -
Replying to @ravinggenius
It was always meant to be public API eventually. Implementation wasn't finished in 4.2. Too many pitfalls to make public
2 replies 0 retweets 0 likes -
Replying to @sgrif
So can I use :value (or Type::Value) to opt out of typecasting? My attributes may be different types, but don't get persisted to db.
1 reply 0 retweets 0 likes -
Replying to @ravinggenius
Yes `Type::Value` is the identity type. (And I recommend always using the class names never the symbol form personally)
1 reply 0 retweets 0 likes -
Replying to @sgrif
Does it matter `ActiveModel::Type::Value` versus `ActiveRecord::Type::Value` matter? I have to call `.new` right?
1 reply 0 retweets 0 likes -
Replying to @ravinggenius
You need to call .new. You can just do `Type::http://Value.new `
1 reply 0 retweets 0 likes -
Replying to @sgrif
I tried that, but Ruby can't find `Type` correctly. :(
3 replies 0 retweets 0 likes
If `ActiveRecord::Type::Value` works though then just `Type::Value` should
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.