Re: [Rails] how is mongoid syntax implemented ?
That is valid hash syntax. You're call a method with a signature like:
On Wednesday, October 23, 2013 9:30:28 PM UTC-4, Dheeraj Kumar wrote:
-- def field(field_name, options = {})
...
end
field_name is a symbol, options is a hash where the keys are symbols and the values are constants (class objects).
field_name is a symbol, options is a hash where the keys are symbols and the values are constants (class objects).
On Wednesday, October 23, 2013 9:30:28 PM UTC-4, Dheeraj Kumar wrote:
It's the new hash syntax introduced in ruby 1.9.
On Oct 23, 2013 11:22 PM, "Jedrin" <jrub...@gmail.com> wrote:--
In mongoid, a ORM mapped database object is like below. The part "type: String" seems to me to not fit into any standard ruby syntax and I was curious how does mongoid implement that ?
class Step
include Mongoid::Document
field :Label, type: String
field :Descript, type: String
field :ErrorText, type: String
embedded_in :step_data
end
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com .
To post to this group, send email to rubyonra...@googlegroups.com .
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ .0e81b056-62c2-403b-aed1- a4e6892a4648%40googlegroups. com
For more options, visit https://groups.google.com/groups/opt_out .
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/80ffb62b-384e-497d-9f2b-9832c702ea9f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home