Tricky...

On Mon, Mar 28, 2011 at 12:12 PM, Tim Griffin <[email protected]> wrote:

> Yes, my sincere thanks for Bryan for stopping me from going in
> circles.
>
> For everyone else's benefit, here are the critical observations that
> had escaped me:
>
> 1. If you don't explicitly name the enum_string with the "name: =>"
> parameter or with a call to set_name, the main key in your locale file
> must include the model name in which the enum_string is defined, as
> well as the tableized name of the enum_string (lower-case/
> pluralized).
>
> ***BUT*** the enum_string's main key can ONLY use the "/" notation.
>
> So, if you do this:
>
> class Document < ActiveRecord::Base
>   hobo_model
>    Region = HoboFields::Types::EnumString.for(:ab, :bc)
>
> you must use this notation:
>
> en:
>  document/regions:
>    ab: "Alberta"
>    bc: "British Columbia"
>
> and ***NOT*** this notation:
>
> en:
>  document:
>    regions:
>      ab: "Alberta"
>      bc: "British Columbia"
>
>
> 2. If you DO explicitly name the enum_string with the "name: =>"
> parameter or with a call to set_name, the keys in your locale file
> must not include the model name.
>
> If you do this:
>
> class Document < ActiveRecord::Base
>   hobo_model
>    Region = HoboFields::Types::EnumString.for(:ab, :bc, :name =>
> "Region")
>
> Your locale file's enum_string key must match the tableized version of
> the name you assigned to the enum_string (note the lower-case first
> letter, and the pluralization).
>
> en:
>   regions:
>     ab: "Alberta"
>     bc: "British Columbia"
>
>
> Tim
>
>
>
> On Mar 27, 2:11 pm, Owen Dall <[email protected]> wrote:
> > Thanks for tracking that down, Bryan.
> >
> > On Sun, Mar 27, 2011 at 1:29 PM, Bryan Larsen <[email protected]
> >wrote:
> >
> >
> >
> > > I helped Tim figure it out.   Here's a working example:
> >
> > > class Document < ActiveRecord::Base
> > >  hobo_model
> > >  Region = HoboFields::Types::EnumString.for(:ab, :bc, :mb, :nb, :nl,
> :ns,
> > > :nt, :nu, :on, :pe, :qc, :sk, :yt, :other)
> > > ...
> >
> > > (config/locales/app.en.yml)
> > > en:
> > >  document/regions:
> >
> > >    ab: "Alberta"
> > >    bc: "British Columbia"
> >
> > > ...
> >
> > > This is for Hobo 1.3.   The corresponding manual page is available, you
> > > just need to know where it is, (the cookbook displays the stable
> manual).
> >
> > >https://github.com/tablatom/hobo/blob/rails3/hobo_fields/test/rich_ty.
> ..
> >
> > > We can set the name explicitly to avoid the slash:
> >
> > > class Document < ActiveRecord::Base
> > >  hobo_model
> > >  Region = HoboFields::Types::EnumString.for(:ab, :bc, :mb, :nb, :nl,
> :ns,
> > > :nt, :nu, :on, :pe, :qc, :sk, :yt, :other, :name => "Region")
> > > ...
> >
> > > en:
> > >  regions:
> >
> > >    ab: "Alberta"
> > >    bc: "British Columbia"
> >
> > > ...
> >
> > > cheers,
> > > Bryan
> >
> > > --
> > > 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.
> >
> > --
> >
> > - Owen
> >
> > Owen Dall, Chief Systems Architect
> > Barquin Internationalwww.barquin.com
> > Cell: 410-991-0811
>
> --
> 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.
>
>


-- 


- Owen

Owen Dall, Chief Systems Architect
Barquin International
www.barquin.com
Cell: 410-991-0811

-- 
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.

Reply via email to