Good evening, guys!
I created a small form with two fields and in the future I intend to expand this form with one or two fields. It happens that the insertion of the data in sqlite is not being done, but it does not give any error.
The application is being developed to be a to-do list.
Can you kindly tell me possible reasons?
Well, I have it as a model:
class ToDoList < ActiveRecord::Base
attr_accessible :is_favorite, :name, :description
has_many :tasks, dependent: :destroy
belongs_to :member
end
and as controller:
class ToDoListsController < ApplicationController
...
def new
@todo_list = ToDoList.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @todo_list }
end
end
...
def create
@todo_list = ToDoList.new(params[:todo_list])
respond_to do |format|
if @todo_list.save
format.html { redirect_to @todo_list, notice: 'Todo list was successfully created.' }
format.json { render json: @todo_list, status: :created, location: @todo_list }
else
format.html { render action: "new" }
format.json { render json: @todo_list.errors, status: :unprocessable_entity }
end
end
end
end
Thank you in advance!
Edit
I noticed that I was calling the wrong params, calling it @todo_list and it was @to_do_list. It serves as an example of lack of attention!
Sail for attention, guys.