Ahh... I didn't see what you were referring too right then.  You're
talking about a way to get the values directly from the enum_string if
declared in the field.

On Mar 3, 2:15 am, Mikkel WF <[email protected]> wrote:
> The document.phase does NOT work.
> It only works if the enum is declared as a constant.
>
> On 2 Mar., 22:38, kevinpfromnm <[email protected]> wrote:
>
> > Document.phase or if you use it as a constant Document::Phase
>
> > On Mar 2, 9:24 am, Mikkel WF <[email protected]> wrote:
>
> > > I solved it by decaring the enum as such:
>
> > > class Document < ActiveRecord::Base
> > >   Phase = HoboFields::EnumString.for("Alignment", "Research",
> > > "Strategy", "Concept Generation", "Detailing", "Documentation")
> > >   fields do
> > >     phase Document::Phase
> > >   end
> > > end
>
> > > And then fetching the values with &Document::Phase.values
>
> > > But i couldn't figure out how to fetch the values if i declared the
> > > enum as
> > > fields do
> > >   phase enum_string("...")
> > > end
>
> > > On 2 Mar., 17:12, Bryan Larsen <[email protected]> wrote:
>
> > > > Hobo Edge has an additional example for filter-menu which filters on
> > > > Lifecycle state, which is similar to an enum_string.   Here are the 
> > > > docs:
>
> > > >   A `<select>` menu intended to act as a filter for index pages.
>
> > > > ### Example
>
> > > > Filtering on state is a common use.   Here's the dryml for Order:
>
> > > >      <filter-menu param-name="state"
> > > > options="&Order::Lifecycle.states.keys" />
>
> > > > And the controller action:
>
> > > >      def index
> > > >        # always validate data given in URL's!!!
> > > >        params[:state]=nil unless
> > > > Order::Lifecycle.states.include?(params[:state]._?.to_sym)
> > > >        finder = params[:state] ? Order.send(params[:state]) : Order
> > > >        hobo_index finder
> > > >      end
>
> > > > See [Filtering stories by
> > > > status](/tutorials/agility#filtering_stories_by_status) in the [Agility
> > > > Tutorial](/tutorials/agility) for an example.
>
> > > > ### Attributes
>
> > > >   - `param-name` - the name of the HTTP parameter to use for the filter
> > > >   - `options` - an array of options for the menu.
> > > >   - `no-filter` - The text of the first option which indicates no filter
> > > > is in effect. Defaults to 'All'
>
> > > > Mikkel WF wrote:
> > > > > How can i make i <filter-menu /> which filters with values from a
> > > > > enum_string field?
>
>

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