caribou / caribou-core

Core functionality for Caribou
44 stars 3 forks source link

Error when creating a habtm relationship #7

Closed miwillhite closed 12 years ago

miwillhite commented 12 years ago

I am editing the View model, attempting to create a link to Field. Here are the params:

{:slug "model", :id "5", :model {:join_model "false", :nested "false", :removed_fields "", :description "a composition of content facets", :abstract "false", :searchable "false", :fields {"0" {:type "string", :id "67", :model_position "0", :default_value "", :name "Name"}, "1" {:type "text", :id "68", :model_position "0", :name "Description"}, "2" {:type "id", :id "69", :model_position "0", :name "Id"}, "3" {:type "integer", :id "70", :model_position "0", :default_value "", :name "Position"}, "4" {:type "integer", :id "71", :model_position "0", :default_value "", :name "Status"}, "5" {:type "integer", :id "72", :model_position "0", :default_value "", :name "Locale Id"}, "6" {:type "integer", :id "73", :default_value "", :model_position "0", :name "Env Id"}, "7" {:type "boolean", :id "74", :default_value "false", :model_position "0", :name "Locked"}, "8" {:type "timestamp", :id "75", :model_position "0", :name "Created At"}, "9" {:type "timestamp", :id "76", :model_position "0", :name "Updated At"}, "10" {:type "link", :id "", :target_id "2", :model_position "10", :reciprocal_name "Views", :name "Fields"}}, :name "View"}, "" "false"}

This is the error:

java.lang.ClassCastException: caribou.model.CollectionField cannot be cast to clojure.lang.IFn
at caribou.model.CollectionField.post_update(model.clj:415)
    at caribou.model$create$fn__711.invoke(model.clj:939)
    at clojure.core.protocols$fn__5558.invoke(protocols.clj:64)
    at clojure.core.protocols$fn__5543$G__5538__5552.invoke(protocols.clj:11)
    at clojure.core$reduce.invoke(core.clj:5995)
    at caribou.model$create.invoke(model.clj:939)
    at caribou.model$create.invoke(model.clj:927)
    at caribou.model.PartField.setup_field(model.clj:465)
    at caribou.model$add_field_hooks$fn__674.invoke(model.clj:872)
    at caribou.model$run_hook$fn__626.invoke(model.clj:770)
    at clojure.core.protocols$fn__5558.invoke(protocols.clj:64)
    at clojure.core.protocols$fn__5543$G__5538__5552.invoke(protocols.clj:11)
    at clojure.core$reduce.invoke(core.clj:5995)
    at caribou.model$run_hook.invoke(model.clj:770)
    at caribou.model$create.invoke(model.clj:938)
    at caribou.model$create.invoke(model.clj:927)
    at caribou.model.CollectionField$fn__461.invoke(model.clj:424)
    at clojure.core$map$fn__3811.invoke(core.clj:2430)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:60)
    at clojure.lang.RT.seq(RT.java:466)
    at clojure.core$seq.invoke(core.clj:133)
    at clojure.core$dorun.invoke(core.clj:2723)
    at clojure.core$doall.invoke(core.clj:2739)
    at caribou.model.CollectionField.post_update(model.clj:421)
    at caribou.model$create$fn__711.invoke(model.clj:939)
    at clojure.core.protocols$fn__5558.invoke(protocols.clj:64)
    at clojure.core.protocols$fn__5543$G__5538__5552.invoke(protocols.clj:11)
    at clojure.core$reduce.invoke(core.clj:5995)
    at caribou.model$create.invoke(model.clj:939)
    at caribou.model.LinkField.setup_field(model.clj:643)
    at caribou.model$add_field_hooks$fn__674.invoke(model.clj:872)
    at caribou.model$run_hook$fn__626.invoke(model.clj:770)
    at clojure.core.protocols$fn__5558.invoke(protocols.clj:64)
    at clojure.core.protocols$fn__5543$G__5538__5552.invoke(protocols.clj:11)
    at clojure.core$reduce.invoke(core.clj:5995)
    at caribou.model$run_hook.invoke(model.clj:770)
    at caribou.model$create.invoke(model.clj:938)
    at caribou.model$create.invoke(model.clj:927)
    at caribou.model.CollectionField$fn__461.invoke(model.clj:424)
    at clojure.core$map$fn__3811.invoke(core.clj:2432)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:60)
    at clojure.lang.Cons.next(Cons.java:39)
    at clojure.lang.RT.next(RT.java:580)
    at clojure.core$next.invoke(core.clj:64)
    at clojure.core$dorun.invoke(core.clj:2724)
    at clojure.core$doall.invoke(core.clj:2739)
    at caribou.model.CollectionField.post_update(model.clj:421)
    at caribou.model$update$fn__729.invoke(model.clj:973)
    at clojure.core.protocols$fn__5558.invoke(protocols.clj:64)
    at clojure.core.protocols$fn__5543$G__5538__5552.invoke(protocols.clj:11)
    at clojure.core$reduce.invoke(core.clj:5995)
    at caribou.model$update.invoke(model.clj:973)
    at caribou.model$update.invoke(model.clj:961)
    at caribou.api.core$update_content.invoke(core.clj:228)
    ...
prismofeverything commented 12 years ago

Fixed! Trying to create fields on fields using fields creates a kind of Ouroboros of self-devouring field guilt. Now, that is resolved! Create associations between fields at your whim.