Try to use 'rake routes' command to figure out the valid routes currently
you have. If any valid routes was added to the routes.rb file, you'll see
it.
--
Best Regards,
Ryan Cheung



On Thu, Feb 23, 2012 at 5:53 PM, simpleton <[email protected]> wrote:

> I have a devise model called admin which gives me current_admin and
> the model has a method called role, which is either 'free' or
> 'standard' or 'premium'.
>
> I have a dashboard_controller with three actions:
>
> def index ... end
> def free ... end
> def premium ... end
>
> I have a passthrough_controller that handles which dashboard action an
> admin should be redirected to based on their role:
>
> class PassthroughController < ApplicationController
>  def index
>    path = case current_admin.role
>      when 'free'
>        dashboard_free_path
>      when 'standard'
>        dashboard_standard_path
>      when 'premium'
>        dashboard_premium_path
>      else
>        admin_signin_path
>    end
>
>    redirect_to path
>  end
> end
>
> And I have these routes set up:
>
> devise_for :admins do
>    match "/admins/sign_out" => "devise/sessions#destroy"
>    match "/dashboard/index" => 'passthrough#index'
>    match "/dashboard/free" => 'dashboard#free', :as
> => :dashboard_free_path
>    match "/dashboard/standard" => 'dashboard#standard', :as
> => :dashboard_standard_path
>    match "/dashboard/premium" => 'dashboard#premium', :as
> => :dashboard_premium_path
> end
>
> This isn't working, but I'd like to know why it isn't working and
> where I'm going wrong.
>
> Thanks
>
> --
> 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.
>
>

-- 
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