brute force prevent nil synapse descriptions
This commit is contained in:
parent
588b62b942
commit
96871cadab
2 changed files with 3 additions and 1 deletions
|
@ -4282,7 +4282,7 @@ Metamaps.Synapse = {
|
|||
node1 = synapsesToCreate[i];
|
||||
topic1 = node1.getData('topic');
|
||||
synapse = new Metamaps.Backbone.Synapse({
|
||||
desc: Metamaps.Create.newSynapse.description,
|
||||
desc: Metamaps.Create.newSynapse.description || "",
|
||||
node1_id: topic1.isNew() ? topic1.cid : topic1.id,
|
||||
node2_id: topic2.isNew() ? topic2.cid : topic2.id,
|
||||
});
|
||||
|
|
|
@ -22,6 +22,7 @@ class SynapsesController < ApplicationController
|
|||
# POST /synapses.json
|
||||
def create
|
||||
@synapse = Synapse.new(synapse_params)
|
||||
@synapse.update_attribute :desc, "" if @synapse.desc.nil?
|
||||
|
||||
respond_to do |format|
|
||||
if @synapse.save
|
||||
|
@ -36,6 +37,7 @@ class SynapsesController < ApplicationController
|
|||
# PUT /synapses/1.json
|
||||
def update
|
||||
@synapse = Synapse.find(params[:id])
|
||||
@synapse.update_attribute :desc, "" if @synapse.desc.nil?
|
||||
|
||||
respond_to do |format|
|
||||
if @synapse.update_attributes(synapse_params)
|
||||
|
|
Loading…
Reference in a new issue