Unable to get submit form to show up

Continuing the discussion from The Hands-on Backbone.js on Rails workshop is now online to take at your own pace:

@Jacqueline Can you share you code? Do you have it on github or in a gist?

Yes, here’s where I have my code on Github:

What is exactly your problem/difficulty? Is it the one in the title of the post?

I stated my problem above:

I’m unable to get the submit form to show for editing a note after creating and coding the edit.jst.eco file. I’m not getting my input form.

Also, when I click on “Back”, I am taken to a blank white page (this is after clicking on a note and then trying to go back w/o using backspace key or back button on browser)

I opened a pull request in which I get the router working.

It fixes none of your problems, but it gets you on the right direction. You were not using backbone to route and render the pages other than the index. After that rails was doing that job, and that’s not what you want. I corrected that for the show page, you should be able to do the same for the edit.

As for the back button it had a wrong link, I corrected that as well on the rails view, but you want it to be rendered by backbone. I added the backbone template without the back button, but adding would be a matter of then catching an event for back buttons, and doing something like this.

I’m not doing the workshop nor am I a backbone expert, but I hope it helps.

I was trying to code along with Sean Griffin who does this Backbone.js video tutorial, and had problems from the get-go with getting it to work for me. For example, in the first video where he walks you through the setup, and then starts the Rails server, you’re supposed to get an alert that says Hello from Backbone, but it didn’t work for me. I didn’t get the alert. I carefully paused the video to make sure I had the same code in the same files and file structure as Sean had, too. So I don’t understand why this is going sideways for me. I find Backbone to be VERY confusing and I really don’t understand it at all.

I’m sorry for the trouble you’ve been having. You should be doing your work for the workshop in a fork of the workshop repo then we’ll all have access to see it and you can commit to it frequently and when you run into trouble you can post and we can see exactly what you code is and help you.

It sounds like you’re working in your own repo, which is ok too. Can you point to a specific commit SHA of the point where you weren’t getting the alert and we can go back there, check it out and help identify the error?

The alert button issue is in a new directory where I tried to start the app tutorial all over from scratch to make sure I didn’t miss anything. I did not make a separate git repo for it yet as I had nothing really to commit that was working. I checked to make sure I had the correct gems and checked VERY carefully for stupid syntax errors in the code files for Backbone after I ran the rails g backbone:install command and set up the root route in Backbone in the router. I am wondering if it’s not some flaw in the way Backbone and the steps in this tutorial are handled by the most updated version of Rails. Because that first little thing should have worked. I should have had a blank web page with just an alert saying Hello from Backbone.

I just tried this for the third time and can’t get anything to work. I forked the repo like @cpytel suggested. After adding the backbone and lodash gems and doing the bundle install, I get this problem (I had to copy/paste my terminal content since for some weird reason, the file uploader would not take a picture upload):.

➜ scratch_pad git:(master) ✗ bundle install
Fetching gem metadata from https://rubygems.org/
Fetching additional metadata from https://rubygems.org/
Resolving dependencies…
Could not find gem ‘lodash (~> 2.2.1) ruby’ in the gems available on this
machine.
➜ scratch_pad git:(master) ✗ gem update
Updating installed gems
Nothing to update
➜ scratch_pad git:(master) ✗ bundle install
Fetching gem metadata from https://rubygems.org/
Fetching additional metadata from https://rubygems.org/
Resolving dependencies…
Could not find gem ‘lodash (~> 2.2.1) ruby’ in the gems available on this
machine.
➜ scratch_pad git:(master) ✗

I tried fixing the problem by running the gem update command, but that didn’t fix it.

OK. I see what happened with the failed gem install. Stupid me forgot the “-rails” and had only “lodash”…SO I will continue trying with this third attempt which is forked from the repo per @cpytel’s suggestion and see what happens with the alert button and the routing the on this one. I am also reading up on Javascript and jQuery too, since it doesn’t hurt.

UPDATE: Got the alert ‘Hello from Backbone’…now, pressing onward…