タグ

RubyとHTTPに関するYassLabのブックマーク (2)

  • 【Rails】render と redirect_to の違いまとめ🔰

    はじめに こんにちは、Takeです。都内でエンジニアとして活動しています。 この記事では、render と redirect_to の違いを調査し、体系的に整理しました。また、これらのメソッドが頻繁に使用されるFlashメッセージにおける Flash と Flash.now の違いについても言及していますので、ぜひご一読いただければ幸いです。 render とは何か? 機能 renderメソッドは現在のリクエストのコンテキスト内でビューテンプレートを直接呼び出す。これにより、新しいHTTPリクエストを発生させずに、サーバーは指定されたビューをクライアントに直接返す。このメソッドは主にフォームのバリデーションエラーが発生した時など、同一ページを再表示する場面で利用される。 図解 サンプルコード def create @user = User.new(user_params) if @user

    【Rails】render と redirect_to の違いまとめ🔰
    YassLab
    YassLab 2024/05/04
    “この記事では、render と redirect_to の違いを調査し、体系的に整理しました。また、これらのメソッドが頻繁に使用されるFlashメッセージにおける Flash と Flash.now の違いについても言及しています”
  • curl-to-ruby: Convert curl commands to ruby's net/http

    Instantly convert curl commands to Ruby's net/http Ruby's net/http is notorious for not having the friendliest API, but it isn't all that bad. Ruby has great gems like faraday, but in libraries and small utilities it's better to kill your dependencies and use what the stdlib provides. This tool turns a curl command into ruby (2.0+) code using net/http. Currently, it knows the following options: -d

    YassLab
    YassLab 2022/12/01
    "Ruby's net/http is notorious for not having the friendliest API, but it isn't all that bad. Ruby has great gems like faraday, but in libraries and small utilities it's better to kill your dependencies and use what the stdlib provides. This tool turns a curl command into Ruby code using net/http."
  • 1