Adding a "partial" from the presenter...

14 views
Skip to first unread message

nathan

unread,
Apr 29, 2012, 4:51:35 PM4/29/12
to pak...@googlegroups.com
I want to put up a warning message if a user tries to use IE with to access my pakyow  application. I would like to have a div in an html file called "ie_detected.html" and render in the applicatoin#index action (depending on user agent detection). Is there a way to do this, currently, using the presenter?  

The only way I have come up with is to load an external file manually:
presenter.view.find("#iie_detected").content= File.open('../views/ie_detected.html').read

Bryan Powell

unread,
Apr 29, 2012, 6:49:09 PM4/29/12
to pak...@googlegroups.com
You can use the View class, like this:

presenter.view.find("#iie_detected").content= View.new('ie_detected.html').to_html

I typically don't like doing things like this from the backend, because it isn't possible to see the result running in prototype mode. In situations like this I usually put the message in the view structure so it's pulled in via view construction, then add a hook to remove it from the view in cases where it isn't needed. Your call though, both are valid options.

Bryan
Reply all
Reply to author
Forward
0 new messages