These are chat archives for canjs/canjs

2nd
Nov 2015
Mihai Fantana
@fantanamihai
Nov 02 2015 10:34
Just a reminder. Using can 2.2.9, I have the following issue:
can.Model.extend('A', {
findOne: function(p) {
return $.ajax({type: 'get', url: '/test/'+p.a});
}
}, {});
A.extend('B', {
findOne: function(p) {
p.a = 2;
return this._super(p);
}
}, {});
When I call findOne on B, I get there is no _super:
A.findOne({a:1}) => /test/1
B.findOne({c:3}) => this._super is undefined
Can you please explain what am I doing wrong here?
dylanrtt
@dylanrtt
Nov 02 2015 19:17
@meconcomputer Are you including the can/construct/super plugin in the file(s) where those models are defined?
dylanrtt
@dylanrtt
Nov 02 2015 20:22
What is the syntax for exporting a function from a component to the references scope, or is that not supported?
Matthew Phillips
@matthewp
Nov 02 2015 20:32
using can-import?
you can do that
<can-import from='some/function' {^@value}='*fn' />
{{*fn()}}
dylanrtt
@dylanrtt
Nov 02 2015 20:36
using a component instance
Matthew Phillips
@matthewp
Nov 02 2015 20:37
oh, well would be th same then
<some-component {^@foo}="*bar" /> {{*bar()}}
sets the foo function as *bar on the reference scope
dylanrtt
@dylanrtt
Nov 02 2015 20:40
then shouldn't this be logging?
Matthew Phillips
@matthewp
Nov 02 2015 20:43
I would expect it to be, let me look
Matthew Phillips
@matthewp
Nov 02 2015 20:53
I'm not sure, there might be a bug there, it looks right to me
@justinbmeyer ?
Justin Meyer
@justinbmeyer
Nov 02 2015 21:23
@dylanrtt there's nothing observable there
so that might be part of the problem
but a bug, for sure
by nothing observable, I mean it's not a foo "attr"
there's just a foo method on the prototype