Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 82719d59
authored
Nov 10, 2011
by
Sascha Depold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first steps for better private method scoping
1 parent
12fd2280
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
2 deletions
lib/model-factory.js
lib/model.js
lib/model-factory.js
View file @
82719d5
...
@@ -115,12 +115,13 @@ ModelFactory.prototype.find = function(options) {
...
@@ -115,12 +115,13 @@ ModelFactory.prototype.find = function(options) {
}
}
ModelFactory
.
prototype
.
build
=
function
(
values
,
options
)
{
ModelFactory
.
prototype
.
build
=
function
(
values
,
options
)
{
var
instance
=
new
Model
(
values
,
Utils
.
_
.
extend
(
this
.
options
,
{
hasPrimaryKeys
:
this
.
hasPrimaryKeys
}))
var
instance
=
new
Model
(
values
,
Utils
.
_
.
extend
(
this
.
options
,
this
.
attributes
,
{
hasPrimaryKeys
:
this
.
hasPrimaryKeys
}))
,
self
=
this
,
self
=
this
options
=
options
||
{}
options
=
options
||
{}
instance
.
__definition
=
this
instance
.
__definition
=
this
//console.log(this.attributes)
Utils
.
_
.
map
(
this
.
attributes
,
function
(
definition
,
name
)
{
Utils
.
_
.
map
(
this
.
attributes
,
function
(
definition
,
name
)
{
if
(
typeof
instance
[
name
]
==
'undefined'
)
{
if
(
typeof
instance
[
name
]
==
'undefined'
)
{
var
value
=
null
var
value
=
null
...
@@ -129,7 +130,7 @@ ModelFactory.prototype.build = function(values, options) {
...
@@ -129,7 +130,7 @@ ModelFactory.prototype.build = function(values, options) {
value
=
self
.
rawAttributes
[
name
].
defaultValue
value
=
self
.
rawAttributes
[
name
].
defaultValue
instance
[
name
]
=
value
instance
[
name
]
=
value
instance
.
addAttribute
(
name
,
value
)
instance
.
__
addAttribute
(
name
,
value
)
}
}
})
})
Utils
.
_
.
each
(
this
.
options
.
instanceMethods
||
{},
function
(
fct
,
name
)
{
instance
[
name
]
=
fct
})
Utils
.
_
.
each
(
this
.
options
.
instanceMethods
||
{},
function
(
fct
,
name
)
{
instance
[
name
]
=
fct
})
...
...
lib/model.js
View file @
82719d5
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment