text_field value is not read in controller when using create form in the index viewlink_to :action => 'create' going to index rather than 'create'Difficulty in getting mp3 to work in PaperclipRails: loop through array to create outputGet the name of a parent resource when working with a nested resourceRails 4 Form Data Is Saving as Nilupgrade to rails 4, can no longer register usersRails pass generated js params from form to controllerNoMethodError in Rooms#indexundefined method `url' for #<ActiveRecord::Associations::CollectionProxy []>Group chat app with ActionCable gives error ActionController::InvalidAuthenticityToken

​Cuban​ ​Primes

Could a space colony 1g from the sun work?

Is there an academic word that means "to split hairs over"?

Pedaling at different gear ratios on flat terrain: what's the point?

Why is the marginal distribution/marginal probability described as "marginal"?

Capital gains on stocks sold to take initial investment off the table

Do high-wing aircraft represent more difficult engineering challenges than low-wing aircraft?

What formula to chose a nonlinear formula?

How does the Heat Metal spell interact with a follow-up Frostbite spell?

bash: Counting characters within multiple files

Square spiral in Mathematica

Given 0s on Assignments with suspected and dismissed cheating?

What are the effects of eating many berries from the Goodberry spell per day?

What kind of environment would favor hermaphroditism in a sentient species over regular, old sexes?

Why aren't satellites disintegrated even though they orbit earth within their Roche Limits?

Why does the U.S military use mercenaries?

Write electromagnetic field tensor in terms of four-vector potential

Divisor Rich and Poor Numbers

What is this rubber on gear cables

Is Precocious Apprentice enough for Mystic Theurge?

Can a person still be an Orthodox Jew and believe that the Torah contains narratives that are not scientifically correct?

Why use a retrograde orbit?

What would a Dragon have to exhale to cause rain?

Why would you put your input amplifier in front of your filtering for and ECG signal?



text_field value is not read in controller when using create form in the index view


link_to :action => 'create' going to index rather than 'create'Difficulty in getting mp3 to work in PaperclipRails: loop through array to create outputGet the name of a parent resource when working with a nested resourceRails 4 Form Data Is Saving as Nilupgrade to rails 4, can no longer register usersRails pass generated js params from form to controllerNoMethodError in Rooms#indexundefined method `url' for #<ActiveRecord::Associations::CollectionProxy []>Group chat app with ActionCable gives error ActionController::InvalidAuthenticityToken






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















The problem is that, I want to create a Group and I'm using the form in index.html.erb to use the create action in groups controller but the parameter :name is not passed to the controller.



the form is:



<%= form_for @group ,url: controller: "groups", action: "create" do |f| %>
<%= f.label :name %>
<%= f.text_field :name, id: 'grpName', class: 'form-control'%>
<%= f.submit "Add Group" , class:"btn btn-light" , onclick: "addGroup();" %>
< %end %>


the controller is:



def index
@groups = Group.all
@group = Group.new
end

def create
@user_id=1
@group = Group.new(group_params)
@group.user_id = @user_id
@group.save
end

private
def group_params
params.require(:group).permit(:name)
end

def group_params
params.require(:group).permit(:name)
end









share|improve this question
























  • please, fix your code formatting

    – buncis
    Mar 23 at 16:19


















0















The problem is that, I want to create a Group and I'm using the form in index.html.erb to use the create action in groups controller but the parameter :name is not passed to the controller.



the form is:



<%= form_for @group ,url: controller: "groups", action: "create" do |f| %>
<%= f.label :name %>
<%= f.text_field :name, id: 'grpName', class: 'form-control'%>
<%= f.submit "Add Group" , class:"btn btn-light" , onclick: "addGroup();" %>
< %end %>


the controller is:



def index
@groups = Group.all
@group = Group.new
end

def create
@user_id=1
@group = Group.new(group_params)
@group.user_id = @user_id
@group.save
end

private
def group_params
params.require(:group).permit(:name)
end

def group_params
params.require(:group).permit(:name)
end









share|improve this question
























  • please, fix your code formatting

    – buncis
    Mar 23 at 16:19














0












0








0








The problem is that, I want to create a Group and I'm using the form in index.html.erb to use the create action in groups controller but the parameter :name is not passed to the controller.



the form is:



<%= form_for @group ,url: controller: "groups", action: "create" do |f| %>
<%= f.label :name %>
<%= f.text_field :name, id: 'grpName', class: 'form-control'%>
<%= f.submit "Add Group" , class:"btn btn-light" , onclick: "addGroup();" %>
< %end %>


the controller is:



def index
@groups = Group.all
@group = Group.new
end

def create
@user_id=1
@group = Group.new(group_params)
@group.user_id = @user_id
@group.save
end

private
def group_params
params.require(:group).permit(:name)
end

def group_params
params.require(:group).permit(:name)
end









share|improve this question
















The problem is that, I want to create a Group and I'm using the form in index.html.erb to use the create action in groups controller but the parameter :name is not passed to the controller.



the form is:



<%= form_for @group ,url: controller: "groups", action: "create" do |f| %>
<%= f.label :name %>
<%= f.text_field :name, id: 'grpName', class: 'form-control'%>
<%= f.submit "Add Group" , class:"btn btn-light" , onclick: "addGroup();" %>
< %end %>


the controller is:



def index
@groups = Group.all
@group = Group.new
end

def create
@user_id=1
@group = Group.new(group_params)
@group.user_id = @user_id
@group.save
end

private
def group_params
params.require(:group).permit(:name)
end

def group_params
params.require(:group).permit(:name)
end






ruby-on-rails






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 23 at 16:40









Sajad Rastegar

85721426




85721426










asked Mar 23 at 16:12









Motaz Abo ElnasrMotaz Abo Elnasr

61




61












  • please, fix your code formatting

    – buncis
    Mar 23 at 16:19


















  • please, fix your code formatting

    – buncis
    Mar 23 at 16:19

















please, fix your code formatting

– buncis
Mar 23 at 16:19






please, fix your code formatting

– buncis
Mar 23 at 16:19













0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55315746%2ftext-field-value-is-not-read-in-controller-when-using-create-form-in-the-index-v%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55315746%2ftext-field-value-is-not-read-in-controller-when-using-create-form-in-the-index-v%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript