zelk
zelk

Reputation: 607

How can you reload Spine.js views when refreshing a page?

For example, I followed the Spine+Rails tutorial in Spine's docs. It is a basic Rails app that lists Posts to CRUD, but with Spine.js, so it's all async and super fast. That's all great.

However, refreshing the page or manually hitting in a url like http://spiny.dev/#/posts/5/edit only loads #/posts' content but keeps the url. It looks like...

this .

... when it should in fact display an editing view.

How can one set up Spine.js to 'resume' to where it should?

Upvotes: 0

Views: 335

Answers (1)

SpoBo
SpoBo

Reputation: 2158

Check your console (cmd+shift+i and then the console tab, or when the dialog pops up press the >= looking icon in the bottom left corner) (this is your new best friend when writing javascript).

You probably have an error that gets thrown like 'Unknown record'. The problem is that you have to fetch your models earlier. Before all the subcontrollers are initialized. At least that's my guess.

Also, shy away from the scaffolding stuff. It gives you too much cleverness and concepts that aren't good for you so early on. Just begin with something basic and refactor as needed so you end up knowing what every bit of code does in the current scaffold code you have.

Upvotes: 1

Related Questions