私はログインページとサインアップページを持っています。私は、ログインボタンやサインアップボタンをクリックした後、ユーザーはマイクロポストになる別のビューにリダイレクトされます。Ruby on Railsで表示するリダイレクトボタン
登録ページのコードは次のとおりです。 (フォーム部分のように) -
<h2 class="text-center">Sign Up</h2>
<%= form_for(input_output_SignUp_url) do |f| %>
<%= f.label :first_name,"First name:" %>
<%= f.text_field :first_name %>
<%= f.label :last_name,"Last name:" %>
<%=f.text_field :last_name %>
<%= f.label :email,"Email:" %>
<%= f.email_field :email %>
<%= f.label :phone,"Phone no:"%>
<%= f.text_field :phone %>
<%= f.label :city,"City:" %>
<%= f.text_field :city %>
<%= f.label :addr_1,"Address 1:" %>
<%=f.text_field :addr_1 %>
<%= f.label :addr_2,"Address 2:" %>
<%= f.text_field :addr_2 %>
<%= f.label :state,"State:"%>
<%= f.text_field :state %>
<%= f.label :postal_code,"Postal Code:"%>
<%= f.text_field :postal_code %>
<%= f.label :password,"Password:"%>
<%= f.password_field :password %>
<%= f.label :password_confirmation, "Confirmation:" %>
<%= f.password_field :password_confirmation, class: 'form-control' %>
<%= button_to "View profile", input_output_micropost_path%>
<% end %>
これは機能しません。私はボタンをクリックすると、それはエラー - Noルートマッチ[POST]を示していない「/ INPUT_OUTPUT /新規アカウント」
次のようにルート・ファイルは次のとおりです。 -
root 'static_pages#home'
get 'static_pages/home'
get 'static_pages/genre'
get 'static_pages/accessories'
get 'static_pages/contactus'
get 'static_pages/aboutus'
get 'input_output/Login'
get 'input_output/SignUp'
get 'input_output/micropost'
get '/genre', to: 'static_pages#genre'
get '/accessories', to: 'static_pages#accessories'
get '/aboutus', to: 'static_pages#aboutus'
get 'contactus', to: 'static_pages#contactus'
get 'Home', to: 'static_pages#home'
get '/Login', to: 'input_output#Login'
get '/micropost', to: 'input_output#micropost'
get '/SignUp', to: 'input_output#SignUp'
end
どのように私はこれを行うことができますエラーは消えますか?
編集: - 尋ねたように、これはすくいルート /home/gauri/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0の結果です。 1/lib/active_support/xml_mini.rb:51:警告:定数:: Fixnumは非推奨です
/home/gauri/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/ activesupport-5.0.1/lib/active_support/xml_mini.rb:52:warning:constant :: Bignumは非推奨になりました。
/home/gauri/.rbenv/versions/2.4.0/lib/ruby/gems/2.4。 0/gems/activesupport-5.0.1/lib/active_support/core_ext/numeric/conversions.rb:138:警告:constant :: Fixnumは推奨されていません
レーキが中止されました!
ArgumentError:ルート定義のコントローラキーがありません。ルートを確認してください。レール/奨学金/奨学金/設定/ routes.rbを上
/ホーム/ gauri /アカデミック/ CS /ルビー:25:ブロック `で「
/ホーム/ gauri /アカデミック/ CS/RubyでRailsの上/ScholarShip/ScholarShip/config/routes.rb:1:in ` 'Railsの/奨学金/奨学金/設定/ environment.rbに上
/ホーム/ gauri /アカデミック/ CS /ルビー:5:`で'
タスク:TOP => routes => environment
リンクするものを眺めたいですか? 'rake routes'を実行し、出力をポストしてください。 –
あなたのルートはすべて「取得」リクエストです。フォームのデータをコントローラーに「ポスト」するルートを追加する必要があります。投稿 'input_output/SignUp' – bkunzi01
@AlejandroMontillaこれは、「サインアップ」ページと「ログイン」ページも含まれるInputOutputというコントローラの一部である「micropost」というビューにリンクしたいと思います。 – sindhugauri