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

brianokken
Many tasks_proj/tests directories exist in chapters 2, 3, 5 that have tests that use the custom markers smoke and get, which are not decl...
New
mikecargal
Title: Hands-On Rust (Chapter 11: prefab) Just played a couple of amulet-less games. With a bit of debugging, I believe that your can_p...
New
lirux
Hi Jamis, I think there’s an issue with a test on chapter 6. I own the ebook, version P1.0 Feb. 2019. This test doesn’t pass for me: ...
New
herminiotorres
Hi! I know not the intentions behind this narrative when called, on page XI: mount() |&gt; handle_event() |&gt; render() but the correc...
New
HarryDeveloper
Hi @venkats, It has been mentioned in the description of ‘Supervisory Job’ title that 2 things as mentioned below result in the same eff...
New
brunogirin
When trying to run tox in parallel as explained on page 151, I got the following error: tox: error: argument -p/–parallel: expected one...
New
New
dsmith42
Hey there, I’m enjoying this book and have learned a few things alredayd. However, in Chapter 4 I believe we are meant to see the “&gt;...
New
s2k
Hi all, currently I wonder how the Tailwind colours work (or don’t work). For example, in app/views/layouts/application.html.erb I have...
New
Henrai
Hi, I’m working on the Chapter 8 of the book. After I add add the point_offset, I’m still able to see acne: In the image above, I re...
New

Other popular topics Top

malloryerik
Any thoughts on Svelte? Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue...
New
PragmaticBookshelf
A PragProg Hero’s Journey with Brian P. Hogan @bphogan Have you ever worried that your only legacy will be in the form of legacy...
New
AstonJ
SpaceVim seems to be gaining in features and popularity and I just wondered how it compares with SpaceMacs in 2020 - anyone have any thou...
New
Margaret
Hello content creators! Happy new year. What tech topics do you think will be the focus of 2021? My vote for one topic is ethics in tech...
New
PragmaticBookshelf
Author Spotlight James Stanier @jstanier James Stanier, author of Effective Remote Work , discusses how to rethink the office as we e...
New
PragmaticBookshelf
Rails 7 completely redefines what it means to produce fantastic user experiences and provides a way to achieve all the benefits of single...
New
PragmaticBookshelf
Author Spotlight Mike Riley @mriley This month, we turn the spotlight on Mike Riley, author of Portable Python Projects. Mike’s book ...
New
PragmaticBookshelf
Author Spotlight Erin Dees @undees Welcome to our new author spotlight! We had the pleasure of chatting with Erin Dees, co-author of ...
New
PragmaticBookshelf
Author Spotlight: Karl Stolley @karlstolley Logic! Rhetoric! Prag! Wow, what a combination. In this spotlight, we sit down with Karl ...
New
DevotionGeo
I have always used antique keyboards like Cherry MX 1800 or Cherry MX 8100 and almost always have modified the switches in some way, like...
New