
Security News
Free Certified Patch for Critical Rails Active Storage Vulnerability
Socket has released a free Certified Patch for a critical Rails Active Storage vulnerability, giving developers time to upgrade to a secure Rails version.
spine-binding
Advanced tools
Spine.Binding is a Spine extension that allows easy binding of data to views.
If you're using Spine with Hem, add the following to your package.json:
{
// ...
"dependencies": {
// ...
"spine-binding": "git://github.com/vojto/spine-binding.git",
}
}
Add the following to your slug.json:
{
// ...
"dependencies": [
// ...
"spine-binding"
]
}
Add this wherever you want to use Spine.Binding (add it to your setup.coffee):
require('spine-binding')
Let's say we are building a to-do list. We have TaskListController class that manages a list of tasks, and renders each task with TaskController.
To use Spine.Binding, add the following code to TaskListController.
class TaskListController
@extend Spine.Binding
@binding
view: TaskController
key: 'cid'
This code will set up a new binding. The view option specifies a class that should be used to render each task.
The key option specifies unique identifier of each item. Each Spine model has a unique cid field that we can use to identify tasks.
Now, each time you want to re-render the collection, call data method:
class TaskListController
render: ->
tasks = Task.all
@data tasks
The data method takes an array of models as an argument, and figures out how to update the DOM elements with minimal effort.
Spine.Binding works with an arbitrary array of objects too, such as this one:
@data [{name: 'Vojtech'}, {name: 'Anna'}]
In this case we would pass name as key option, assuming it's unique.
Spine.Binding works with any model layer and it doesn't do any model event handling, you have to do that manually.
You could for example re-render any time the collection changes:
constructor: ->
Task.bind 'change', =>
@data Task.all
This event will only be fired when the collection changes, that is when an object is added or removed.
Handling object changes should be responsibility of view that represents one instance (TaskController in this case.)
FAQs
Spine.Binding is a Spine extension that allows easy binding of data to views.
The npm package spine-binding receives a total of 0 weekly downloads. As such, spine-binding popularity was classified as not popular.
We found that spine-binding demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.

Security News
Socket has released a free Certified Patch for a critical Rails Active Storage vulnerability, giving developers time to upgrade to a secure Rails version.

Security News
/Threat Research
A malicious Ruby gem runs a credential-stealing worm during installation, poisons AI coding tools, and can wipe files when a stolen GitHub token is revoked.

Security News
GitHub is tightening GitHub Actions security with new restrictions on privileged pull request workflows. Here's what changes and how maintainers are affected.