> Hi - I was expecting the handling to be more along the lines
> of ":required is a new value in the hash".
I would agree that it is really confusing for programmers who has no
Rails background, though I don't know if I can call it a documentation
bug. If you know it, it's obvious, but if not, it's not. Here are
some hints:
- .rb files are Ruby files. DSL fragments such as field
declarations of Hobo Fields, assocations (has_many, etc.) and
validations (validates_presence_of, etc) are all syntactically
valid Ruby expressions.
- Rails uses "hash as a named option" feature throughout the API.
A `:key => something` argument is probably a named option and you
should place it as the last argument of the method call. Simple
`:key` argument (without associated value) is not a hash and it
won't be a named option. There are some exceptions such as
`button_to(name, options = {}, html_options = {})` helper where
two hashes are expected and you must sometimes explicitly place
surrounding braces to solve ambiguities.
> Even stuff like
> http://api.rubyonrails.org/classes/ActiveRecord.ConnectionAdapaters/TableDefinition.htl
> doesn't mention that the :scale and :precision have to come
> last because they are in a named option hash.
The method signature `column(name, type, options = {})` and the
descriptions in
http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/TableDefinition.html
tell you that `name` should be provided first, `type` should be
second, and options hash may be followed and the options may contain
`:scale => something`.
-----
Tomoaki Hayasaka <[email protected]>
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en.