Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6645455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:17:23+00:00 2026-05-26T00:17:23+00:00

I have this form in my application.html.erb. <%= form_tag(:action=>index, :controller=>posts) %> <p> // code

  • 0

I have this form in my application.html.erb.

<%= form_tag(:action=>"index", :controller=>"posts") %>
  <p>
  // code here
  </p>

I dont understand why is this getting directed to posts->create instead of posts->index?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T00:17:24+00:00Added an answer on May 26, 2026 at 12:17 am

    Basically, Rails observes and obeys “RESTful” web service architecture. With REST and Rails, there are seven different ways to interact with a server regarding a resource. With your current code, specifying the form’s action as index doesn’t make sense: Rails’ form helpers can either POST, PUT or DELETE.

    If you wanted to create a post, then redirect to the index, you can do so in the applicable controller action:

    class PostsController < ApplicationController
    ...
    
    def create
      @post = Post.new
    
      respond_to do |format|
      if @post.save
        format.html { redirect_to(:action => 'index') }
    end
    end
    

    While your form would look like:

    <% form_for @post do |f| %>
      # put whatever fields necessary to create the post here
    <% end %> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my c# application i have this small form which is used to set
I have this easy little form in my JavaFX application. I want to use
I have a C# Windows Form application that contains a menu with this event:
I have an C# form application that use an access database. This application works
I am using C# with a Windows Application Form. In this I have a
Events are synchronous in C#. I have this application where my main form starts
I have an application. First I display a splash screen, a form, and this
I have this form in my view: <!-- Bug (extra 'i') right here-----------v -->
I have a comment form (in comments/_form.html.erb) that I use in my other controllers
i have create a c# form application for parsing Html using Winista.html parser. Now

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.