i am new in rails world, i would like a little help, i run devise gem and works perfect, i just have a small problem after sign in, i am not get the page a want and always redirect to my index page, can you guys give a little help?
on views: i have my index file for dashboard and for index.
there my code:
routes.rb
Rails.application.routes.draw do
devise_for :users
resources :dashboard
root to: "home#index"
dashboard_controller.rb
class DashboardController < ApplicationController
end
before_filter :authenticate_user!
def index
end
home_controller.rb
class HomeController < ApplicationController
end
def index
if user_signed_in?
redirect_to :controller=>'dashboard', :action => 'index'
end
end
aplication.html.erb
<!DOCTYPE html>
<html>
<head>
<title>Devise</title>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
</head>
<body>
<div id="user_nav">
<% if user_signed_in? %>
Signed in as <%= current_user.email %>. Not you?
<%= link_to "Sign out", destroy_user_session_path, :method => :delete %>
<% else %>
<%= link_to "Sign up", new_user_registration_path %> or <%= link_to "sign in", new_user_session_path %>
<% end %>
</div>
<% flash.each do |name, msg| %>
<%= content_tag :div, msg, :id => "flash_#{name}" %>
<% end %>
<%= yield %>
</body>
</html>
thank you, all the best
Aucun commentaire:
Enregistrer un commentaire