ruby on rails - My forum is not updating the table? -
i trying update table using fourm :-
<div class="row"> <div class="col-md-6 col-md-offset-3"> <%= form_for message.new |f| %> <%= f.label :to %> <%= f.email_field :to, class: 'form-control' %> <%= f.label :subject %> <%= f.text_field :subject, class: 'form-control' %> <%= f.label :content %> <%= f.text_area :content, class: 'form-control' %> <%= f.submit "log in", class: "btn btn-primary" %> <% end %> </div> </div>
and in controller have done :-
def create @message = message.new(user_params) redirect_to root_url end def user_params params.require(:message).permit(:to, :subject, :content) end
but when check table, there no update .
where going wrong ? table have 2 more attributes , not filling them forum .
.new
builds new object, need save
persist database.
def create @message = message.new(user_params) @message.save! redirect_to root_url end
Comments
Post a Comment