TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Unmiss – Ruby's method_missing in JavaScript

2 pointsby ramadisover 7 years ago

1 comment

smt88over 7 years ago
This isn&#x27;t the best solution for whatever is happening to you.<p>If you don&#x27;t know what method is going to be called on your class, there&#x27;s something wrong with your code. I&#x27;m assuming this either happens when A) your input isn&#x27;t validated&#x2F;sanitized (generic routing allows <i>any</i> method on your class to be called) or B) you&#x27;re coding sloppily.<p>In the case of A, you need to validate your routing. If a user calls a route that doesn&#x27;t exist, they should get a 404. This can become a security issue if you don&#x27;t do it.<p>In the case of B, JS already tells you that the method isn&#x27;t defined. Or, if you&#x27;re using a good IDE, JSLint, TypeScript, or Flow, you should see a warning before you run your code.
评论 #15148048 未加载