エントリーの編集
エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
Rails controllerでdef newでインスタンス変数を定義する意義。 - Qiita
記事へのコメント0件
- 注目コメント
- 新着コメント
このエントリーにコメントしてみましょう。
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています
- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
Rails controllerでdef newでインスタンス変数を定義する意義。 - Qiita
class TweetsController < ApplicationController def index @tweets = Tweet.all.order(created_at: :d... class TweetsController < ApplicationController def index @tweets = Tweet.all.order(created_at: :desc) end def create @tweet = TweetsTag.new(tweet_params) if @tweet.valid? @tweet.save return redirect_to root_path else render "new" end end private def tweet_params params.require(:tweets_tag).permit(:message, :name) end end class TweetsTag include ActiveModel::Model attr_accessor :message, :name with