我删除了/ public /文件夹中的Index.html。我在视图中添加了一个“应用程序”文件夹。 在其中我添加了一个新的index.html.erb。我希望成为我的首页/主页。
在我的新“index.html.erb”中,我设置了:
link_to 'sign in', {:controller => 'devise/sessions', :action => 'new'}
但它将我重定向到“application#index”。
我设置root :to => "application#index
我如何设置此选项,以便在我登录后将其路由到“posts #index”,例如?
我的/public/index.html中是否有机会使用.erb oder .haml?
非常感谢!!
答案 0 :(得分:1)
我不确定我是否完全理解您的问题,但听起来您希望用户在登录后被定向到不是根目录的页面。为此,您可以在application_controller中实现after_sign_in_path_for方法。 shown in the devise wiki
def after_sign_in_path_for(resource_or_scope)
posts_index_path
end