Can you send your view code and your controller code? The snippets are not
enough.

..tony..

On Thu, Dec 3, 2009 at 2:35 PM, Ming <[email protected]> wrote:

> OK.  I ran the debugger and figured out the problem, which unless I
> misunderstand, is not correct behavior.
>
> in the view index.haml.html,
>
> the assignment,
>
>   - x = c.slug
>
> then the use of x,
>
>   = url(:catalog, x)
>
> works fine
>
> BUT, direct use of the method call,
>
>   url(:catalog, c.slug)
>
> produces a undefined method error.
>
> On Dec 3, 2:52 pm, Tony Mann <[email protected]> wrote:
> > This seems impossible. You will need to post your view code so we can see
> > it.
> >
> > ..tony..
> >
> >
> >
> > On Thu, Dec 3, 2009 at 11:34 AM, Ming <[email protected]> wrote:
> > > class Catalog
> > >  include DataMapper::Resource
> >
> > >  storage_names[:default] = 'main'
> >
> > >  property :id, Integer, :field => 'code', :key => true
> > >  property :item, Text
> >
> > >  has n, :subcatalogs
> >
> > >  def slug
> > >      "whatever"
> > >  end
> > > end
> >
> > > if i try to call slug in a view, where c is an instance of Catalog,
> >
> > > c.slug
> >
> > > yields an undefined method error.
> >
> > > Yet c.id and c.item access just fine.
> >
> > > --
> >
> > > You received this message because you are subscribed to the Google
> Groups
> > > "merb" group.
> > > To post to this group, send email to [email protected].
> > > To unsubscribe from this group, send email to
> > > [email protected]<merb%[email protected]><
> merb%[email protected]<merb%[email protected]>
> >.
> > > For more options, visit this group at
> > >http://groups.google.com/group/merb?hl=en.
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "merb" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected] <merb%[email protected]>.
> For more options, visit this group at
> http://groups.google.com/group/merb?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"merb" 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/merb?hl=en.


Reply via email to