You can also do
if record.try(:wamms_support) instead of "if
record.respond_to?(:wamms_support) && record.wamms_support"

:)

On Wed, Apr 22, 2009 at 2:36 AM, Sergio Cambra .:: entreCables S.L. ::. <
[email protected]> wrote:

>
> El Tuesday 21 April 2009 22:40:18 Atastor escribió:
> > Well..of course you are right suspecting about the helper :all part.
> > Now iff I could only remember, why I turned it on...guess I have to
> > dig in my commits...*SIGH*
> >
> > Thanks loads anyway :)
> > Michael
>
> helper :all is there when you create your rails project
>
> >
> >
> > On 20 Apr., 09:34, "Sergio Cambra .:: entreCables S.L. ::."
> >
> > <[email protected]> wrote:
> > > El Sunday 19 April 2009 19:54:15 Atastor escribió:
> > > > Can somebody explain to me, why I do have to restrict my
> > > > list_row_class with a class-check to make it work?
> > > >
> > > > > module WettkasHelper
> > > > >   def list_row_class(record)
> > > > >     if record.class == Wettka
> > > > >       if record.wamms_support
> > > > >         'wamms_supported'
> > > > >       end
> > > > >     end
> > > > >   end
> > > >
> > > > If I *don't* restrict it, aka:
> > > > > module WettkasHelper
> > > > >  def list_row_class(record)
> > > > >    if record.wamms_support
> > > > >      'wamms_supported'
> > > > >    end
> > > > >  end
> > > >
> > > > I do get an error message from *all* other classes, when accessing
> the
> > > >
> > > > index, e.g.:
> > > > > NoMethodError in Diszips#index
> > > > > Showing
> > > > >
> vendor/plugins/active_scaffold/frontends/default/views/_list_record.h
> > > > >tml. erb where line #5 raised: undefined method `wamms_support' for
> > > > > #<Diszip:0x320ccc4>
> > > >
> > > > Puzzled (as always)
> > > > Michael
> > >
> > > Probably, you have helper :all in ApplicationController
> > > And you can use "if record.respond_to?(:wamms_support) &&
> > > record.wamms_support" instead of checking record's class
> > >
> > > --
> > > Sergio Cambra .:: entreCables S.L. ::.
> > > Nicolás Guillén 6, locales 2 y 3. 50.018 Zaragoza
> > > T) 902 021 404 F) 976 52 98 07 E) [email protected]
> >
> >
>
>
> --
> Sergio Cambra .:: entreCables S.L. ::.
> Nicolás Guillén 6, locales 2 y 3. 50.018 Zaragoza
> T) 902 021 404 F) 976 52 98 07 E) [email protected]
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to