I had been checking through the view path code this past week -- for a
different reason: I don't want any checking in the view paths at all.

I am still don't have a clear picture of the entire dispatch stack,
but as far as I can tell, the default responder attempts to render
something, view_paths gets checked, then it throws
ActionView::MissingTemplate ... api_behavior (such as rendering json /
xml) gets called as a result of rescuing from that exception. Assuming
you are checking for the view within the dispatch and depending on
what you want to do, you can handle the exception yourself (if it
isn't found) or extend the default responder.

Ho-Sheng Hsiao
http://ruby-lambda.blogspot.com

On Aug 6, 10:29 am, Andrew Romanov <[email protected]> wrote:
> Hello, I just want to check in the code if some template is present in
> views or not. In rails 2.3 I did this with following code -
> view_paths.find_template(template_path, default_template_format). But
> in rails3 it doesn't work and when I try to use view_paths.find with
> some parameters, I get strange error:
>
> NoMethodError Exception: You have a nil object when you didn't expect
> it!
> You might have expected an instance of Array.
> The error occurred while evaluating nil.map
>
> Can you help me with function to check if view exists in rails3?

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to