class Locmare.ProfilerModule.AssociationModule.BelongsTo extends Backbone.View tagName: 'div' initialize: (options) -> @association = options.association @belongs_to_manifest = options.belongs_to_manifest pm = @parent_model() m = new pm({id: @parent_id()}) _this = this m.fetch({cache: true}).done -> _this.filer = new Locmare.Filer({ item_name: _this.parent_model().item_name(), items: [m], pager: null, operators: _this.profiler().operators }) _this.render() render: () -> this.$el.html(@filer.el) if @filer this item: () -> @profiler().item parent_model: () -> @belongs_to_manifest.model() parent_id: () -> c = @model_belongs_to_manifest().id_column @item().get(c) model_manifest: () -> Manifest.manifest().models[@profiler().item_name] model_belongs_to_manifest: () -> @model_manifest().associations.belongs_to[@belongs_to_manifest.item_name] profiler: () -> @association.profiler