惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

I
Intezer
月光博客
月光博客
The GitHub Blog
The GitHub Blog
C
Check Point Blog
Stack Overflow Blog
Stack Overflow Blog
博客园 - 司徒正美
Microsoft Azure Blog
Microsoft Azure Blog
G
Google Developers Blog
B
Blog
Recorded Future
Recorded Future
Martin Fowler
Martin Fowler
The Register - Security
The Register - Security
A
About on SuperTechFans
云风的 BLOG
云风的 BLOG
L
LangChain Blog
T
The Blog of Author Tim Ferriss
M
MIT News - Artificial intelligence
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
aimingoo的专栏
aimingoo的专栏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
U
Unit 42
Y
Y Combinator Blog
P
Proofpoint News Feed
MyScale Blog
MyScale Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园 - 三生石上(FineUI控件)
宝玉的分享
宝玉的分享
博客园 - Franky
D
DataBreaches.Net
爱范儿
爱范儿
博客园 - 【当耐特】
F
Full Disclosure
博客园 - 叶小钗
MongoDB | Blog
MongoDB | Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
H
Heimdal Security Blog
D
Docker
有赞技术团队
有赞技术团队
The Cloudflare Blog
S
Security Affairs
V
Visual Studio Blog
N
News and Events Feed by Topic
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Google DeepMind News
Google DeepMind News
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
AI
AI
V
V2EX
Hacker News: Ask HN
Hacker News: Ask HN
Hacker News - Newest:
Hacker News - Newest: "LLM"

Codebase Audits & Rescue | Ally Piechowski

How to Be a Good Open Source Maintainer "The Git Commands I Run Before Reading Any Code" "Ruby 3.2 Is EOL: What You Actually Need to Do" "Rails 7.2 to 8.1 Upgrade: What Actually Breaks and How to Fix It" "Why Your Engineering Team Is Slow (It's the Codebase, Not the People)" "Migrating from Sprockets to Propshaft: Is It Worth It?" "How to Close a Tab in Vim" "How I Audit a Legacy Rails Codebase in the First Week" "How to Open a New Tab in Vim" "Rails default_scope: Why You Should Never Use It" "Solved: Warning: Using the last argument as keyword parameters is deprecated" "Vim: How to Open Current Opened File in New Tab" "Rails: How to Use Greater Than/Less Than in Active Record where Statements" "What is the best time for stand-up meetings?" "Using Let and Context to Modularize RSpec Tests" "What Is Fed vs Unfed Sourdough Starter?" "My Father, My Mentor, My Teacher" "How to Get Over Burnout" "What's the difference between a Good Developer and a Good Googler?" Codebase Audits & Rescue | Ally Piechowski
"Solved: ActionController::ParameterMissing (param is missing or the value is empty)"
"Ally Piechowski" · 2020-01-03 · via Codebase Audits & Rescue | Ally Piechowski

When using Ruby on Rails' strong_params with require, there is a chance the key doesn't exist. When this happens, an ActionController::ParameterMissing exception is thrown.

Ally Piechowski · · 1 min read
Solved: ActionController::ParameterMissing (param is missing or the value is empty)

In Ruby on Rails, strong_params are a necessity to work with ActionController parameters, but sometimes an exception of ActionController::ParameterMissing is thrown… Why?

The Code

params.require(:message).permit(:text, :author_id)

The Exception

ActionController::ParameterMissing (param is missing or the value is empty: message)

The Fix

The error is occurring because our params hash does not include the root key :message. We can diagnose this issue by utilizing params.inspect in either an interactive console or printing the output of certain commands.

The command I tend to use most to identify mishaps is params.inspect.

For example, the output of this command might be:

<ActionController::Parameters {"messages"=>{"text"=>"My Message", "author_id"=>1337}} permitted: false>

In this case, it appears as though there is a typo in our view! The key was typed as messages rather than message. The fix is easy, change the view to submit message instead.


Related Articles