Dynamic Routing in Rails for landing page -
i have in routes.rb
get 'admin', to: 'admin/appointments#index' i want route dynamic based on user logs in. can't this, should set this?
get 'admin', to: @current_admin.landing_page
it sounds you're trying introduce controller logic routes. want 1 admin_landing_page route, supply current user parameter.
so in routes, want this
get 'admin', to: landing_page/:admin_identifier and in controller
@current_admin = youradminmodel.find(params:[:admin_identifer]) then can use @current_admin in view customize based on data current_admin, such as
<h1>welcome homepage of admin <%= @current_admin.name %>!</h1>
Comments
Post a Comment