“.save” only inserts null values in database

前端 未结 3 1035
时光说笑
时光说笑 2021-01-15 08:14

I\'m trying to make a RoR application for a Hospital so it has patients, doctors, offices, etc.

The problem I\'m having is that, at the patient \"Sign-up\", I\'m not

3条回答
  •  清歌不尽
    2021-01-15 08:37

    Can you show us how this method is called? Also are you sure that params[:name] and params[:pid].

    You have used the column :pid and :pID, as below

    pat = Patient.where(:pID => id).first
    if pat == nil
      pat = Patient.new(:name => pName, :pID =>id)  # should use pat = Patient.new(:name => pName, :pid =>id)
      pat.save
    end
    

提交回复
热议问题