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

  • Home
  • SEARCH
  • 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 7536125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:29:26+00:00 2026-05-30T06:29:26+00:00

When I submit the form, the data is not being sent in the post

  • 0

When I submit the form, the data is not being sent in the post and set via parameters. I can’t for the life of me figure out why. This form is in the plan/show action, so that’s why you see me setting the @action variable there. It is sent via JS.

routes.rb

resources :plans do 
    resources :actions
end

action.rb

belongs_to :plan

plan.rb

has_many :actions

plans_controller.rb

def show
    @plan = current_user.plans.includes(:actions).find(params[:id])
    @action = Action.new

    respond_to do |format|
      format.html # show.html.erb
      format.json { render json: @plan }
    end
end

actions_controller.rb

before_filter :get_plan    

def create
    @action = @plan.actions.new(params[:action])
    @action.user_id = current_user.id
    @action.save
end

private

def get_plan
    @plan = current_user.plans.find(params[:plan_id])
end

create.js.erb in views/actions folder

$('div#actions').prepend("<%= escape_javascript(render @action) %>");
$('div#<%= dom_id(@action) %>').effect('highlight');

_form.html.erb partial

<%= form_for ([@plan, @action]), remote: true do |f| %>
  <%= f.text_field :desc %>
  <%= f.number_field :days %>
  <%= f.submit %>
<% end %>

parameters sent via POST (missing action hash – why??)

Started POST "/plans/1/actions"
Parameters: {"utf8"=>"✓", "authenticity_token"=>"**removed**", "commit"=>"Create Action", "plan_id"=>"1"}

DB Schema

create_table "plans", :force => true do |t|
  t.string   "name"
  t.integer  "user_id"
  t.datetime "created_at", :null => false
  t.datetime "updated_at", :null => false
end

create_table "actions", :force => true do |t|
    t.string   "desc"
    t.integer  "plan_id"
    t.integer  "days"
    t.datetime "created_at", :null => false
    t.datetime "updated_at", :null => false
end
  • 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-30T06:29:27+00:00Added an answer on May 30, 2026 at 6:29 am

    Action is a reserved word. If you call it anything else (except controller, which is also reserved) then it will work.

    http://guides.rubyonrails.org/action_controller_overview.html#routing-parameters

    The params hash will always contain the :controller and :action keys, but you should use the methods controller_name and action_name instead to access these values.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi so i cant seem to figure out why this form will not validate
I need to submit data from a form to an SQL2005 database via a
This is for a custom Editform.aspx being used to submit data to a custom
When using jQuery 's ajax method to submit form data, what is the best
i have a submit page in html . when i submit the form data,
$('#post_form').submit(function() { $(#ajax_bar_loader).show(); $.ajax({ url: 'add.html', data: $('#post_form').serialize(), dataType: 'json', type: 'post', success: function(
When I submit data in my form it changes abcd to \abcd\ on the
I'd like to submit data in a form, over HTTPS, without allowing the browser
I got this code in my submit form <form id=myform action='hello.php' method='GET'> <input type=button
I have read a ton about this problem, but I cannot figure it out.

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.