[Rails] What to do if you can't get parameters with form_with

Solution

--Write only the url or model. (Only url is described this time)

Before editing

erb:_form.html.erb


<%= form_with(model: @set, url: "/sets/create", local: true) do |f| %>
  <div class="form-title">
    <%= f.label :title, "title" %>
    <%= f.text_field :title %>
  </div>
<% end %>

After editing

erb:_form.html.erb


<%= form_with(url: "/sets/create", local: true) do |f| %>
  <div class="form-title">
    <%= f.label :title, "title" %>
    <%= f.text_field :title %>
  </div>
<% end %>

Recommended Posts

[Rails] What to do if you can't get parameters with form_with
[Rails] What to do if you can't get an error message with the errors method
What to do if you can't use the rails command
What to do if you get angry with OpenSSL with pyenv install
What to do if the Rails server can't start
What to do if rails server can't be stopped
What to do if you get a java.io.IOException in GlassFish
# What to do if you accidentally do rails db: migrate: drop
What to do if you can't get the text of an element in Selenium
What to do if you get a gcc error in Docker
What to do if you get a DISPLAY error in gym.render ()
What to do if you get a "302" error in your controller unit test code in Rails
What to do if you get an error in Basic authentication during Rails test code
What to do if you get an error saying "Please enter a valid value" when getting with Rails datetime_field
What to do if you push incorrect information
What to do if you get a groovy warning in Thymeleaf Layout
What to do if you get an uninitialized constant Likes Controller error
What to do if you can't install the plugin from the Eclipse marketplace
What to do if you get an error when you hit Heroku logs
What to do if you get a MiniMagick vulnerability alert on GitHub
What to do if you get a "Mysql2 :: Error: Operand should contain 1 column (s)" error in Rails
What to do if you get a SQLite3 :: BusyException: database is locked error
What to do if you can't activate the select box created by bootstrap-select
What to do if you get the error message unrecognized selector send to instance "***"
What to do if you get an error with bundle install by entering gem'bcrypt' in your Gemfile
What to do if you accidentally create a model
What to do if you get Application with name appName is already registered. When you try to start GlassFish
What to do if you should have installed Rails but an error occurs with rails -v (for beginners)
What to do if you get an error on heroku rake db: migrate
What to do if you get angry if you don't have nokogiri while installing wp2txt
What to do if you get To install the missing version, run `gem install bundler: 2.1.4`
What to do if you can't bundle update and bundle install after installing Ruby 3.0.0 in the Rails tutorial
What to do if you get the error Too long with no output (exceeded 10m0s) on CircleCI
What to do if you get an "A server is already running." Error when you try to start the rails server
What to do if you get a wrong number of arguments error in binding.pry
What to do if you get a NoClassDefFoundError when trying to run eclipse on Java9
What to do if you get the error Couldn't find Item without an ID
What to do if you get a port error when docker-compose up on Mac
What to do if you cannot execute with the command "Java package name / class name"
How to get along with Rails
What to do if you get the warning "Uniqueness validator will no longer enforce case sensitive comparison in Rails 6.1." in Rails 6.0
[Java] [Spring] What to do if you cannot Autowire with Type Mismatch after annotating Spring Security
What to do if you enable UFW on Ubuntu VM on GCP and you can't connect to SSH
[Rails] What to do if you accidentally install bundle in the production environment in your local environment
What to do if you change the Listen Address from the settings screen with Mattermost docker
What to do if you installed Ruby with rbenv but the version does not change
What to do if validation doesn't work with the update action
[Rails] What to do if data is not registered in DB
What to do if the Rails page doesn't appear in Rails tutorial 1.3.2
What to do if Cloud9 is full in the Rails tutorial
What to do if you forget the root password in CentOS7
What to do if you cannot roll back the migration (UnknownMigrationVersionError)
How to make a jar with old Hadoop (hadoop-core-0.20.2-cdh3u6) in Gradle: (What to do if you get Could not expand ZIP ..)
If you dare to compare Integer with "==" ...
What to do if you get a JNI shared library error when trying to build in Eclipse
What to do if you get an [An HTTP request took too long to complete.] Error in Docker.
What to do if the app is not created with the latest Rails version installed when rails new
What to do if you get "Changes not staged for commit:" when you git status after git add.
What to do if JavaMail cannot be used with OpenJDK 11 or later
[Composer] [Laravel] What to do if you cannot install due to insufficient memory
What to do if you don't like the code generated by swagger-codegen-cli