-1
電子メールアドレスとパスワードをデータベースに入れたら、これらのデータはコントローラに送られ、これらはモデルに保存されます。私は結果をモデルに保存したい
私はこれらのコードを考えるのでしかし、私は初心者だ
class ConnectionController < ActiveRecord::Base
def index
@user = User.all
render :json => user
end
end
のようなコントローラーで
class Userdatum < ActiveRecord::Base
user = User.new
user.attributes = {name : "Yuri", :email : "odyssey"}
user.save
end
のようなモデルで
class CreateUserdata < ActiveRecord::Migration
def change
create_table :userdata do |t|
t.string :name
t.string :email
t.timestamps null: false
end
end
end
のような移行ファイルにコードを書きました間違っているが、私はそれを修正する方法を知らない。どのように修正する必要がありますか?
パスワードとメールアドレスをサーバーのDBに入れたいと思います。