apotonick/cells — Issue #107: Render cell's view in the current format
Author: semaperepelitsa
Created: 2012-02-19 22:07:27+00:00
State: open

My Rails 3.2 app has "mobile" format alias for mobile browsers. And there are also 2 versions of footer partial, one for desktop and one for mobile ones.

views/layouts/application.html.haml and application.mobile.haml
= render 'footer'

views/application/_footer.html.haml
%p This is a big footer for desktop browsers

views/application/_footer.mobile.haml
%p This is a small footer for mobile browsers

So when a user visits my website with mobile browser he sees the smaller footer. (The example views are simplified.) How do I do the same thing using cells? I suppose the following scheme should work but it doesn't: only html (desktop) version is rendered all the time.

views/layouts/application.html.haml and application.mobile.haml
= render_cell :footer, :display

cells/footer/display.html.haml
%p This is a big footer for desktop browsers

cells/footer/display.mobile.haml
%p This is a small footer for mobile browsers