jefff

jefff

Agile Web Development with Rails 7: unpermitted parameter error (page 199)

@rubys

I’ve been struggling to get the active_job to work and after hitting a wall I resorted to using the book’s latest source code and I’m still getting an error when I submit my order. Here’s the console:

14:40:27 web.1  |   ↳ app/controllers/orders_controller.rb:40:in `block in create'
14:40:27 web.1  | Unpermitted parameters: :routing_number, :account_number. Context: { controller: OrdersController, action: create, request: #<ActionDispatch::Request:0x000000010bb5cf00>, params: {"authenticity_token"=>"[FILTERED]", "order"=>{"name"=>"this is my name", "address"=>"this is my address", "email"=>"test@example.org", "pay_type"=>"Check", "routing_number"=>"123", "account_number"=>"456789"}, "commit"=>"Place Order", "controller"=>"orders", "action"=>"create"} }
14:40:27 web.1  | Unpermitted parameters: :routing_number, :account_number. Context: { controller: OrdersController, action: create, request: #<ActionDispatch::Request:0x000000010bb5cf00>, params: {"authenticity_token"=>"[FILTERED]", "order"=>{"name"=>"this is my name", "address"=>"this is my address", "email"=>"test@example.org", "pay_type"=>"Check", "routing_number"=>"123", "account_number"=>"456789"}, "commit"=>"Place Order", "controller"=>"orders", "action"=>"create"} }
14:40:27 web.1  | Unpermitted parameters: :name, :address, :email, :pay_type. Context: { controller: OrdersController, action: create, request: #<ActionDispatch::Request:0x000000010bb5cf00>, params: {"authenticity_token"=>"[FILTERED]", "order"=>{"name"=>"this is my name", "address"=>"this is my address", "email"=>"test@example.org", "pay_type"=>"Check", "routing_number"=>"123", "account_number"=>"456789"}, "commit"=>"Place Order", "controller"=>"orders", "action"=>"create"} }

Same error if I run my code or I run the book’s source.

Marked As Solved

rubys

rubys

Author of Agile Web Development With Rails

Very observant! This is actually from the previous edition, and to the best of my knowledge nobody else noticed this. The problem actually is in the previous chapter where the new fields were added to the form but not to the database.

You may think this is cheating, but as it doesn’t further any narrative to spell out that code, I’m adding it to the Playtime exercises at the end of chapter 12. It simply is a matter of creating a migration and adding the fields to order_params.

Popular Prag Prog topics Top

New
iPaul
page 37 ANTLRInputStream input = new ANTLRInputStream(is); as of ANTLR 4 .8 should be: CharStream stream = CharStreams.fromStream(i...
New
yulkin
your book suggests to use Image.toByteData() to convert image to bytes, however I get the following error: "the getter ‘toByteData’ isn’t...
New
herminiotorres
Hi @Margaret , On page VII the book tells us the example and snippets will be all using Elixir version 1.11 But on page 3 almost the en...
New
conradwt
First, the code resources: Page 237: rumbl_umbrella/apps/rumbl/mix.exs Note: That this file is missing. Page 238: rumbl_umbrella/app...
New
AndyDavis3416
@noelrappin Running the webpack dev server, I receive the following warning: ERROR in tsconfig.json TS18003: No inputs were found in c...
New
fynn
This is as much a suggestion as a question, as a note for others. Locally the SGP30 wasn’t available, so I ordered a SGP40. On page 53, ...
New
kolossal
Hi, I need some help, I’m new to rust and was learning through your book. but I got stuck at the last stage of distribution. Whenever I t...
New
tkhobbes
After some hassle, I was able to finally run bin/setup, now I have started the rails server but I get this error message right when I vis...
New
andreheijstek
After running /bin/setup, the first error was: The foreman' command exists in these Ruby versions: That was easy to fix: gem install fore...
New

Other popular topics Top

AstonJ
If it’s a mechanical keyboard, which switches do you have? Would you recommend it? Why? What will your next keyboard be? Pics always w...
New
New
foxtrottwist
Here’s our thread for the Keyboardio Atreus. It is a mechanical keyboard based on and a slight update of the original Atreus (Keyboardio ...
New
AstonJ
Thanks to @foxtrottwist’s and @Tomas’s posts in this thread: Poll: Which code editor do you use? I bought Onivim! :nerd_face: https://on...
New
Exadra37
I am a Linux user since 2012, more or less, and I always use Ubuntu on my computers, and my last 2 laptops have been used Thinkpads, wher...
New
AstonJ
Biggest jackpot ever apparently! :upside_down_face: I don’t (usually) gamble/play the lottery, but working on a program to predict the...
New
PragmaticBookshelf
Author Spotlight James Stanier @jstanier James Stanier, author of Effective Remote Work , discusses how to rethink the office as we e...
New
New
husaindevelop
Inside our android webview app, we are trying to paste the copied content from another app eg (notes) using navigator.clipboard.readtext ...
New
PragmaticBookshelf
Author Spotlight: Karl Stolley @karlstolley Logic! Rhetoric! Prag! Wow, what a combination. In this spotlight, we sit down with Karl ...
New

Latest in PragProg

View all threads ❯