Hello, tricky problem.
I have a controller that is:
def create
.
.
@project = Project.find(params[:project]
@Log = Logs.create(params[:action]).merge(:project_id => @project.id))
...
end
The issue hereis that sometimes when DEF CREATE, I'll have a project and I want to record that. Other times I won't and that's perfectly fine, I still want to create the @Log
What's the right way in Rails to handle this. I'll want to make sure:
- The first line @project doesn't error.
- Also that the @log doesn't error but inserts '' or NIL whatever is rails standard.
Thank you