Do I have a controller instance in the cell? I have no idea. Here is a better explanation of what I am doing:<br><br>In ApplicationController I have:<br><br>helper_method :is_admin?<br><br>and then the implementation of the method. I can use is_admin? method in HolidayController but not in its cell.<br>
<br>class HolidayController < ApplicationController<br> layout 'categories'<br> before_filter :only_moderators<br> auto_complete_for :user, :email<br> in_place_edit_for :user, :total_holiday<br><br> def index<br>
@user = User.new<br> @admin_dashboard = render_cell :admin_dashboard, :display, :user => @user<br> is_admin? current_user<br> end<br><br>So in the cell when I trie to use it:<br><br>class AdminDashboardCell < ::Cell::Base<br>
<br> def display<br> if is_admin? 3438<br> render :view => 'admin_display'<br> else<br> render :view => 'non_admin_display'<br> end<br> end<br>end<br><br><br>I get: <br><pre>undefined method `is_admin?'</pre>
<br><div class="gmail_quote">On Tue, Feb 9, 2010 at 5:30 PM, Tim Cowlishaw <span dir="ltr"><<a href="mailto:tim@timcowlishaw.co.uk">tim@timcowlishaw.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im"><br>
On 9 Feb 2010, at 17:23, Riccardo Tacconi wrote:<br>
<br>
> I am trying to use Rails Cells. I have a is_admin? method but is not accessible from Cells controller (Cell::Base). Do you know how I can access mothods in application controller?<br>
><br>
<br>
</div>Hmm - correct me if I'm wrong, but (assuming they're public methods), you should be able to call them on the @controller instance variable from within a cell instance?<br>
<br>
Cheers,<br>
<br>
Tim<br>
<br>
_______________________________________________<br>
Chat mailing list<br>
<a href="mailto:Chat@lists.lrug.org">Chat@lists.lrug.org</a><br>
<a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" target="_blank">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Riccardo Tacconi<br>Web developer at Wolseley UK <br>VIRTUELOGIC LIMITED (Director)<br><br><a href="http://www.linkedin.com/in/riccardotacconi">http://www.linkedin.com/in/riccardotacconi</a><br>
<a href="http://riccardotacconi.blogspot.com/">http://riccardotacconi.blogspot.com/</a><br><a href="http://twitter.com/rtacconi">http://twitter.com/rtacconi</a><br>Linux user: #400461<br>