Saturday, January 2, 2010

[Rails] Re: How to explore the environment?

On Jan 2, 12:32 pm, Fritz Trapper <li...@ruby-forum.com> wrote:
> pharrington wrote:
> > On Jan 2, 11:19 am, Fritz Trapper <li...@ruby-forum.com> wrote:
> >> format.xml { render :xml => @zaehlers }
> >> end
> >> end
>
> > Look at this carefully. You're closing the respond_to block, and then
> > closing the index method. keineZaehlerVorhanden isn't a class method,
> > so of course the error will be thrown.
>
> keineZaehlerVorhanden is a method of ApplicationController and it works
> inside the index action.
>
> The verify statement is written usually at class level. Right? My idea
> was, only to verfy, if the method keineZaehlerVorhanden fails.
>
> The interesting story is, that the construct around the verify worked
> fine until I accidentally run a rake rails:update
>
> Seems, that the updated rails version changed something in the handling
> of controllers.
>
> My question: How to implement a verification, that should not be
> executed under a certain condition?
>

Well now, verify only exists to prevent actions from even being
*invoked* unless certain conditions of the request are met. If you
need tighter control, to filter based on more than just the request,
just use a before_filter. Either way, you should probably focus on
*precisely* what you're trying to accomplish, and the solution will
probably be obvious (and definitely simpler than doing the same check
in two different places).

> (Background:
> The action should be executable for anybody, as long as no users are
> added to the data base - aka installation phase of my app.)
> --
> Posted viahttp://www.ruby-forum.com/.

OK yeah, this is before_filter material. Don't know if the lack of
users in the DB appropriately denotes the "installation phase," but
thats for you to think about.

--

You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate