For training, I create a simple rails app. Then
rails g scaffold Tache titre:string desc:text --skip-stylesheets
rake db:migrate
rails g bootstrap:install static
After that, I start the server, and I click on "Add Tache", I fill the 2 fields, and then I got this error:
param is missing or the value is empty: tach
# Never trust parameters from the scary internet, only allow the white list through.
def tach_params
params.require(:tach).permit(:titre, :desc)
end
end
So I looked in taches_controller.rb, and I notice that tache is truncated. If I change:
params.require(:tach).permit(:titre, :desc)
to
params.require(:tache).permit(:titre, :desc)
It works. And this line of code is not the only one with the last character truncated.
Example:
def update
respond_to do |format|
if @tach.update(tach_params)
format.html { redirect_to @tach, notice: 'Tache was successfully updated.' }
format.json { render :show, status: :ok, location: @tach }
else
format.html { render :edit }
format.json { render json: @tach.errors, status: :unprocessable_entity }
end
end
end
Can you tell me why it is truncated like this ? I must have miss something but I cannot see what.
Regards