def create
@nugget = Nugget.new(nugget_params)
if @nugget.valid?
@nugget.save!
render json: @nugget
else
render json: {error: "Please complete required fields"}, status: 400
end
end
private
def nugget_params
params.require(:nugget).permit(:id, :title, :img_url, :video_url, :question, :body, :theme_id)
end
I can persist a string but not the Dante object which I can see the API console.log. The record is created with other attributes but the :body is nil . Not sure why? Any help and examples to persist data and then read the data back in React would be greatly appreciated
Hi @jodyneckles , you have to check your ajax method and see if you are sending the data. put a debugger on js or a debugger in the backend. check your network (in chrome) to see what are you really sending
I am relatively new to programming and would like to replace a standard TextArea with a Dante2 React Component.
I can edit content but would like to persist it a Rails database.
In React I have a createNuggetForm.js looks like this:
In React the API.js looks like this:
The Rails nuggets_controller.rb looks like this:
I can persist a string but not the Dante object which I can see the API console.log. The record is created with other attributes but the :body is nil . Not sure why? Any help and examples to persist data and then read the data back in React would be greatly appreciated