You would be able to see them, yes. That's why it's best to secure your controller actions as well as your views to ensure that, even if someone disabled styling or if they typed in the path to those actions explicitly, they would be unable to access that functionality.
I prefer not hiding things with CSS, myself; using JavaScript instead to add those dynamic elements to the DOM after the cached page has loaded.
Nice episode, but I have a doubt. If I have the Edit|Destroy links available at all times, but hidden using CSS, doesn't it mean that if I disable CSS from my browser I'll be able to "at as an admin"? (I mean, see the full page, including those links and all the other hidden "actions").
i really can't see the benefits of using this kind of libraries inside rails. i mean, if i had to build something from scratch and have to structure the app, so maybe there something like backbone.js will be helpfull.
but i don't see the need of backbone.js inside rails since ror is already well structured and all the JS stuff can be fully served with jquery (or similar)...in fact, what i see here is backbone is complicating the "fun" of programming on rails.
...do im right? or i'm missing something? please, somebody help me to understand...
I can use facebook omniauth locally. Perhaps your problem lies with your ssl certificate? I had that problem, you can see it's resolution here
Now, I have a question of my own. Using this method described by rbates, if a user successfully authenticates using Twitter which doesn't provide an email, he is taken to the signup page to complete the registration process. Now, if he doesn't complete the registration process, the @user remains in the session (I don't know how) so the next time you try to register, you'll have that authentication method attached to the created user, which could be a completely different user. How do I solve this? Basically, all I need to do is delete the user if I leave the signup page so how do I do that?
Braintree looks way better than say authorize.net, but Stripe has these advantages:
- Developer friendly, less headaches
- No monthly fees
- Very easy setup
@1. I was wondering the same. Values like that are prone to change so it's best to have them in some sort of global variable. I had always used the approach:
I see one advantage to the meta tag version in that you don't have to give your coffeescript file an .erb extension. This can confuse certain text editors. Other than that, I can't figure out why he would have used a meta tag.
If you will be covering KnockoutJS (which is currently my preference after evaluating most of the frameworks) then you may want to take a look at knockout-rails gem.
This tutorial is very much geared towards a particular way of using backbone on rails. (Understandable since this is a railscast)
I would suggest learning backbone yourself as a standalone html and js served out of public and communicating with your restful resources first, that way you can learn more about things like modularizing your app vs namespacing etc.
I really liked this railscast, but i'm wondering if can be the backbone/eco part easly separated from rails project and compiled to make an external client?
I think it would be worth to mention ExtJS 4 / Sencha Touch 2. It is more comprehensive and powerful than Backbone. It uses similar approach - client side MVC but Sencha have also validators, a lot of widgets and the killer app - Sencha Designer 2, graphics IDE for fast building the whole application (see: http://vimeo.com/36420727) In all such solutions Rails can be narrowed to be just RESTfull server...
I got the same error and I have been searching for the answer from last three days.. It's jst freaking me out.. Is there a real solution to this error??
You can do a lot with noscript tags and to make sure pages behind js links are crawled, you can include their urls in a sitemap and submit it to google, etc..
Backbone is more mature - there are lots of online videos, blog posts, and example apps for BB - not so much for Ember. Right now Ember also lacks support for routing and persistence.
I get an exception thrown when I start dealing with the routers. I'm not going to ruin the forum by pasting my (exhaustively long) trace in here, but I am getting the following message: Error: Parse error on line 7: Unexpected 'TERMINATOR'. Can anyone point me in the right direction? This seems like a CoffeeScript thing that I'm just lost on. Thanks in advance!
Being forced to install a bloated (120+m) DivX player just to watch my beloved RailsCasts is not making me happy. It's probably not your doing, but please pass along the disgruntlement of at least one (and probably many more) viewers about this HUGE step backward by Sublime
One thing i would REALLY like to know: With all these really nice client side mvc frameworks popping up, what the heck do we do about making our app's content searchable/crawlable? I really have not seen much insight into this problem.
Since most (all?) of the web crawlers don't use javascript, do we REALLY have to design separate pages for the spiders?
I implemented it on one of my models, but it seems that it only keeps a history of the original slug, even after every edit. Is this how it's supposed to work?
Say I have a title of "Hello World" which generates a slug "hello-world"
If I edit this to "Hello World 2" and then eventually to "Hello World 3", am I supposed to have all 3 history changes, or just the original?
hello-world - original works
hello-world-2 - doesn't work <-- does this not get stored?
hello-world-3 - latest works
You really have stepped up your game by branching into these new technologies. I for one find this screencast invaluable. I have watched numerous screencasts, paid and free, and this was the easiest to grok. Keep up the great work and I'll keep paying you monthly :D
Looking forward to the Spine, KnockoutJS and Ember screencasts.
I would also like to know what you would personally invest time into learning for the future? It seems that it's a toss up between Backbone and Ember
Glad to see more people talking about json templating for building apis. Here's an alternative to rabl that we wrote at Zaarly called bldr https://github.com/ajsharp/bldr
I do hope to cover other JavaScript libraries such as Knockout, Spine, and Ember in the future. Not certain when or in what order. Thanks for the suggestion.
I'm calling Entry.update (class method) so it has no context of the entry record I'm trying to update, which is why it is necessary to pass params[:id] to it. The params[:entry] contains the attributes that will be updated.
Thanks for mentioning this. I was debating between backbone-on-rails and backbone-rails, both are great projects. Went with backbone-on-rails because of the simpler generator was easier to build off of.
You would be able to see them, yes. That's why it's best to secure your controller actions as well as your views to ensure that, even if someone disabled styling or if they typed in the path to those actions explicitly, they would be unable to access that functionality.
I prefer not hiding things with CSS, myself; using JavaScript instead to add those dynamic elements to the DOM after the cached page has loaded.
Nice episode, but I have a doubt. If I have the Edit|Destroy links available at all times, but hidden using CSS, doesn't it mean that if I disable CSS from my browser I'll be able to "at as an admin"? (I mean, see the full page, including those links and all the other hidden "actions").
i really can't see the benefits of using this kind of libraries inside rails. i mean, if i had to build something from scratch and have to structure the app, so maybe there something like backbone.js will be helpfull.
but i don't see the need of backbone.js inside rails since ror is already well structured and all the JS stuff can be fully served with jquery (or similar)...in fact, what i see here is backbone is complicating the "fun" of programming on rails.
...do im right? or i'm missing something? please, somebody help me to understand...
Hey! Thanks for the link to Sencha Designer 2. I have read a lot about Sencha Touch 2 in the last month. It looks very cool!
The entire form can be given a class, for instance to use twitter's bootstrap, through the following:
Thats's neat. I am trying to re-code some unfinished application using RABL.
Nevermind, I guess I found the answer to my problem. Here's how I tackled it:
You should change that session info to nil not after the creation action but immediately after building the resource.
I can use facebook omniauth locally. Perhaps your problem lies with your ssl certificate? I had that problem, you can see it's resolution here
Now, I have a question of my own. Using this method described by rbates, if a user successfully authenticates using Twitter which doesn't provide an email, he is taken to the signup page to complete the registration process. Now, if he doesn't complete the registration process, the @user remains in the session (I don't know how) so the next time you try to register, you'll have that authentication method attached to the created user, which could be a completely different user. How do I solve this? Basically, all I need to do is delete the user if I leave the signup page so how do I do that?
Braintree looks way better than say authorize.net, but Stripe has these advantages:
- Developer friendly, less headaches
- No monthly fees
- Very easy setup
@1. I was wondering the same. Values like that are prone to change so it's best to have them in some sort of global variable. I had always used the approach:
Stripe.setPublishableKey('<%= STRIPE_PUBLIC_KEY %>')
I see one advantage to the meta tag version in that you don't have to give your coffeescript file an .erb extension. This can confuse certain text editors. Other than that, I can't figure out why he would have used a meta tag.
Thanks Ryan for the episode.
If you will be covering KnockoutJS (which is currently my preference after evaluating most of the frameworks) then you may want to take a look at knockout-rails gem.
Simple screencast that demos validations part of it:
http://blog.approache.com/2011/12/knockoutjs-validations-video.html
(it went into Ruby5, so seems like people liked it).
Cheers.
Thanks! In my case I did something similar to the following:
locals: { show_price: defined?(show_price) ? show_price : false }
Just a suggestion to everyone here:
This tutorial is very much geared towards a particular way of using backbone on rails. (Understandable since this is a railscast)
I would suggest learning backbone yourself as a standalone html and js served out of public and communicating with your restful resources first, that way you can learn more about things like modularizing your app vs namespacing etc.
learn backbone, then backbone on rails.
I really liked this railscast, but i'm wondering if can be the backbone/eco part easly separated from rails project and compiled to make an external client?
Woah, backbone.js is like a completely different framework from rails.
Following this tutorial felt like going through a Python tutorial, I don't understand anything. hahah :D
I need to look up how backbone.js work or what its purpose is because I don't know anything about it.
Looks like the latest version has a fix for this:
https://github.com/norman/friendly_id/issues/224
first off: I am using rails 2.1.1 and ruby 1.8.7. I have the gem installed so I'm pretty sure that is all setup.
But here is my issue:
map.ipad_push '/api/ipad/v1/push/user/:user_id.:format', :controller => 'api', :action => 'push'
I have my api_controller.rb, and an action defined in it called "push"
in views/api i have file push.json.rabl
But when I try to view the json, I get the "Missing template api/push.json.erb in view path /Users/pwgustafson/Desktop/HitFix/hitfix2/app/views"
I was able to get this working in another rails 3 app, so I'm curious if there might be some basic thing I'm doing wrong to get this working.
Not sure why but each day lists out the all the articles for me instead of just the ones for that day. Any suggestions?
day_method is correct too (I'm using :due_date and it has a datatype as date).
Any idea what's wrong?
I'm seeing this same issue. Only the original slug is saved in history. I had assumed that all past slugs would be recorded. Seems less than ideal.
Yeah, really check your CoffeeScript formatting / indentation. I had a couple of those. I had to turn on soft tabs.
I think it would be worth to mention ExtJS 4 / Sencha Touch 2. It is more comprehensive and powerful than Backbone. It uses similar approach - client side MVC but Sencha have also validators, a lot of widgets and the killer app - Sencha Designer 2, graphics IDE for fast building the whole application (see: http://vimeo.com/36420727) In all such solutions Rails can be narrowed to be just RESTfull server...
Very nice Episode!
It would be nice if you could easily customize the xml output with CDATA for special characters :)
This is exactly thing I need! Thanks for your reply.
Great episode, but not really useful in my current project. I would love an episode about fragment caching instead!
I wonder why no one mentions the command rake rails:update - even the Rails 3.2 release notes don't.
I got the same error and I have been searching for the answer from last three days.. It's jst freaking me out.. Is there a real solution to this error??
You can do a lot with noscript tags and to make sure pages behind js links are crawled, you can include their urls in a sitemap and submit it to google, etc..
Backbone is more mature - there are lots of online videos, blog posts, and example apps for BB - not so much for Ember. Right now Ember also lacks support for routing and persistence.
I get an exception thrown when I start dealing with the routers. I'm not going to ruin the forum by pasting my (exhaustively long) trace in here, but I am getting the following message: Error: Parse error on line 7: Unexpected 'TERMINATOR'. Can anyone point me in the right direction? This seems like a CoffeeScript thing that I'm just lost on. Thanks in advance!
VLC.. or download the mp4.. or click WebM in any browser that supports it...
Being forced to install a bloated (120+m) DivX player just to watch my beloved RailsCasts is not making me happy. It's probably not your doing, but please pass along the disgruntlement of at least one (and probably many more) viewers about this HUGE step backward by Sublime
One thing i would REALLY like to know: With all these really nice client side mvc frameworks popping up, what the heck do we do about making our app's content searchable/crawlable? I really have not seen much insight into this problem.
Since most (all?) of the web crawlers don't use javascript, do we REALLY have to design separate pages for the spiders?
I have a question about the history feature.
I implemented it on one of my models, but it seems that it only keeps a history of the original slug, even after every edit. Is this how it's supposed to work?
Say I have a title of "Hello World" which generates a slug "hello-world"
If I edit this to "Hello World 2" and then eventually to "Hello World 3", am I supposed to have all 3 history changes, or just the original?
hello-world - original works
hello-world-2 - doesn't work <-- does this not get stored?
hello-world-3 - latest works
Thanks!
In case anyone wants the coffeescript. Note that I kept the
.submit
bit in addition to.keyup
in case the user hits submit.You really have stepped up your game by branching into these new technologies. I for one find this screencast invaluable. I have watched numerous screencasts, paid and free, and this was the easiest to grok. Keep up the great work and I'll keep paying you monthly :D
Looking forward to the Spine, KnockoutJS and Ember screencasts.
I would also like to know what you would personally invest time into learning for the future? It seems that it's a toss up between Backbone and Ember
Awesome Stuff!
No worries on the length, please do follow up casts!
I've learned a ton!
Glad to see more people talking about json templating for building apis. Here's an alternative to rabl that we wrote at Zaarly called bldr https://github.com/ajsharp/bldr
Thanks for another great episode!
Have you had a look at https://github.com/josevalim/active_model_serializers
Yes, take a look at using the
node
keyword because this allows for very flexible responses. Just added the beginning of a guide for it here: https://github.com/nesquena/rabl/wiki/Flexible-Responsesalso check out joey b's backbone screencasts.
his are paid screencasts as well. both ryan and joey's are excellent. happy to support both guys.
Thanks heaps another marvelous cast
While following along I had trouble formatting the coffee script correctly in textmate any ideas?
Cheers
Dave
What's about batman.js? :-)
Made by the shopify guys and looks very interesting!!
Unfortunately, there are not very much good tuts/videos out there.
A whole series about JavascriptMVCs would be absolutely awesome!
I've been working a lot with Spine lately, and it's very nice. There's a
spine-rails
gem that makes integration really easy.Angular.js is also interesting...
I do hope to cover other JavaScript libraries such as Knockout, Spine, and Ember in the future. Not certain when or in what order. Thanks for the suggestion.
I'm calling
Entry.update
(class method) so it has no context of the entry record I'm trying to update, which is why it is necessary to passparams[:id]
to it. Theparams[:entry]
contains the attributes that will be updated.I hope to cover Twitter Bootstrap in the future, thanks for the suggestion.
Good point, I'll look into this and consider covering it in part 2.
Fixed the link and I'll look into the cut-off issue. Thanks for letting me know about these.
Thanks for mentioning this. I was debating between backbone-on-rails and backbone-rails, both are great projects. Went with backbone-on-rails because of the simpler generator was easier to build off of.