🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.ruby
Article #713

Re: czy kontroler istnieje

#713
From: info
Date: Thu, 22 Nov 2007 20:41
20 lines
1683 bytes
On 22 Lis, 15:39, FOX <u...@company.xx> wrote:
> Witam
>
> Chciałbym zrobić menu uzależnione od tego
> czy dany kontroler istnieje w aplikacji.
> Czy jest jakaś metoda ROR która zwraca
> informację o tym czy kontroler istnieje ?
>
> Pozdrawiam
> Marcin

Nie jestem pewien czy istnieje do tego specjalna metoda, ale możesz
posłużyć się np. czymś takim:
def controller_exists?(controller)
  begin
    Object.const_get(controller + 'Controller')
  rescue
    false
  end
end
Technical Details
Message-ID: <db85cc68-b307-4e6a-b7fb-2f9c7a7a16dc@w28g2000hsf.googlegroups.com>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!feed.news.interia.pl!news.nask.pl!news.nask.org.pl!goblin1!goblin.stu.neva.ru!proxad.net!feeder1-2.proxad.net!64.233.178.134.MISMATCH!postnews.google.com!w28g2000hsf.googlegroups.com!not-for-mail
References: <fi44c1$302$1@atlantis.news.tpi.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!feed.news.interia.pl!news.nask.pl!news.nask.org.pl!goblin1!goblin.stu.neva.ru!proxad.net!feeder1-2.proxad.net!64.233.178.134.MISMATCH!postnews.google.com!w28g2000hsf.googlegroups.com!not-for-mail
From: info@comgroup.pl
Newsgroups: pl.comp.lang.ruby
Subject: Re: czy kontroler istnieje
Date: Thu, 22 Nov 2007 12:41:28 -0800 (PST)
Organization: http://groups.google.com
Lines: 21
Message-ID: <db85cc68-b307-4e6a-b7fb-2f9c7a7a16dc@w28g2000hsf.googlegroups.com>
References: <fi44c1$302$1@atlantis.news.tpi.pl>
NNTP-Posting-Host: 62.21.18.200
Mime-Version: 1.0
X-Trace: posting.google.com 1195764088 28846 127.0.0.1 (22 Nov 2007 20:41:28 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 22 Nov 2007 20:41:28 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: w28g2000hsf.googlegroups.com; posting-host=62.21.18.200;  posting-account=qJ4txgoAAAA6mKlQgAbvoTYCT1HSQT55
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; pl; rv:1.8.1.8)  Gecko/20071008 Firefox/2.0.0.8,gzip(gfe),gzip(gfe)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit