On Mar 1, 2011, at 1:53 PM, Todd A. Jacobs wrote:

> On Mar 1, 10:35 am, "Todd A. Jacobs" <[email protected]>
> wrote:
>> Short of redefining the show method in the controller, how can I allow
>> guests to index without show?
> 
> I tried this in the controller, but it doesn't work:
> 
> class JobsController < ApplicationController
> 
>  hobo_model_controller
> 
>  if signed_up?
>    auto_actions :all
>  else
>    auto_actions :all, :except => :show
>  end
> 
> It returns "undefined method `signed_up?' for JobsController:Class"
> even though the documentation says that these methods are available to
> both models and controllers. Do I need to call the method in some
> other way?

The code at the controller class level only gets evaluated *once* (at load 
time), so signed_up? wouldn't make much sense there. 

To your original question, you can define conditionals in view_permitted? based 
on the passed field, and that may do what you want here.

Also, you may want to do this in your controller if you really, really don't 
want guests hitting the show action:

def show
  redirect_to :action => :index unless signed_in?
  hobo_show
end

--Matt Jones

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" 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/hobousers?hl=en.

Reply via email to