如何在Rails中重定向到另一页的标签?

时间:2018-09-26 06:34:40

标签: javascript ruby-on-rails bootstrap-4

如何在Rails中重定向到另一个页面的标签? 当我单击第一页的按钮时,当我单击设置时,它会将我重定向到页面的默认选项卡(基本),我想将其重定向到通知选项卡。

第一页视图:

.button
    %a{:href => edit_student_path(current_student)}
        settings 

标签页视图:

%ul.nav.nav-pills
    %li.active
        %a{"data-toggle" => "tab", :href => "#student-basic", :role => "tab"} basic-info
    %li
        %a{"data-toggle" => "tab", :href => "#student-notification", :role => "tab"} notification


.tab-content
    #student-basic.tab-pane.active
        = render 'basic_info_form'
    #student-notifications.tab-pane
        = render 'notifications_form'

1 个答案:

答案 0 :(得分:0)

您可以将css类connection.connect()作为参数传递,这是一个示例:

使用按钮查看:

active

标签:

.button
    %a{:href => edit_student_path(current_student, tab: "notification")}
        settings