Rails localhost自定义登陆页面与设计

时间:2015-09-05 02:40:30

标签: ruby-on-rails ruby-on-rails-4 devise

Rails默认localhost:3000映射到welcome_controller #index页面,我想在root用户中使用我的自定义登录页面。我也使用设计进行身份验证设置。

当我给localhost:3000 devise自动重定向到localhost:3000 / users / sign_in。

如何更改自定义页面的根目录以及放置index.html文件的位置,以便可以查看着陆页。

1 个答案:

答案 0 :(得分:0)

您可以将其添加到SyntaxError in AfiliadoController#index /Users/cristiantorres/Documents/pruebaRailsTransporte/app/controllers/afiliado_controller.rb:4: syntax error, unexpected ':', expecting => ...re(afiliacionvehiculos: {date :fechaInicio..:fechaFinal }) ... ^ /Users/cristiantorres/Documents/pruebaRailsTransporte/app/controllers/afiliado_controller.rb:4: syntax error, unexpected '}', expecting keyword_end ...ate :fechaInicio..:fechaFinal }) ... ^ 文件的顶部:

routes.rb

将为您提供此路线:

get "/" => "custom_controller#custom_action", as: :custom_root_path

然后,您可以将自定义目标网页的内容放在custom_root_path GET / custom_controller#custom_action custom_action.html.erb的相应视图(custom_controller文件)中。

例如,如果您将自定义控制器命名为custom_action且操作为landing_pages_controller,则路径将为:

index

然后,您的get "/" => "landing_pages#index", as: :custom_root_path 文件中会有index方法,并且会有一个landing_pages_controller.rb文件,您可以在其中放置自定义目标网页的内容。