RailsCasts Pro episodes are now free!

Learn more or hide this

Recent Comments

Avatar

when we use "rails g scaffold products ...",the generated file products_controller.rb will crash the ajax.
to fix it ,we need to remove the follow code:

   respond_to do |format|
      format.html # index.html.erb
      format.xml { render :xml => @products }
    end

Avatar

I like it very much, hope you can have a look at my site

Avatar

Guys, please stop bitching about a high quality free service.
Thanks

Avatar

Thanks for this cast :)

I am liking it but maybe because I didn't see the previous about Omniauth ;)

Thanks for your job!

Avatar

Why do we need another authentication solution? What is the major difference between the plugins, would you recommend to use Devise, OmniAuth, Restful Authentication or Authlogic?

Avatar

You are sure doing a lot of OmniAuth screencasts, are they paying you to make them? :\

I feel like for almost a whole month it's about the same thing.

I miss the variety that the show used to have.

Regardless, thanks again for doing what you do!

Avatar

After going through this awesome railscasts I realized that I wasn't sure how to make record deletions work well with this system.

For me, when I delete a record, I am redirected to the index, and not even on the same page of results I was on. This is totally jarring. I was thinking I could pass in the page param (and other params like sortable uses) to make the destroy links able to take us to the right page of results.

But if I wanted to do this with ajax, how could that be done? In the best case I was thinking you might delete the record locally with a fade out and then load one record at the bottom of the page of results you're on (this record would be from the next page - if you don't load it that one record won't show if you click to go to the next page).

The fade out is a nice visual touch. But another acceptable way to do this would be to just replace the products div with a new version of the current page of results you're on. This would handle loading that new record from the next page. What's the best way to implement this?

Thanks for the amazing railscast!

Avatar

Hi Ryan,

Thanks for the screen cast. But one question how do l de-active a with devise so that they are still in the system but just cant login. With Authlogic is was as simple as an active field but having trouble working it out now

Avatar

Sorry, I was using with_scope in a controller. And that's why that error. My bad.

Avatar

Ryan, is with_scope deprecated in rails 2.3.9? Cuz I get the NoMethodError:Undefined method 'with_scope'

Avatar

Hi Ryan,

First thank you so much for everything !!

Would you show me the code to also pass the customer shipping name and adress in this "def paypal_url" ?

Avatar

I am having a problem getting this to work. The request header isn't being set to javascript so the controller isn't rendering the .js template (in FF it is shown as being set to "*/*" and Safari it shows application/xml). See the link for more info.

Thanks

Avatar

Those new to this episode, like myself, should check out Ryan's updated GitHub repo for this episode: https://github.com/ryanb/complex-form-examples, where there is a branch for doing this unobtrusively with jQuery. Tim Riley forked it, and has a great working copy here: https://github.com/timriley/complex-form-examples
Piggybacking on their work, I made a jQuery plugin to help clean up the js process: https://github.com/mboynes/nestedAttributes

Thanks, Ryan! Awesome work.

Avatar

The omniauth part 1 video appears to be broken. I can't get past about the 6:10 mark, with either version of the video (.mov or .m4v).

Avatar

Thanks, Ryan. That was awesome.

Avatar

Here is a more tighter integration to Facebook, by extending Ryans screencast:

http://blog.assimov.net/post/1635826492/facebook-integration-with-omniauth-and-devise-on-rails

Avatar

Rails 3 includes all helpers by default, so the include Urlhelper is not necessary.

Avatar

Ryan!!! you are the best! I love your work!!! You are my role model! i would like to be you when i grow up! Awesome work! :)

Avatar

I have been watching RailsCasts for roughly 2 years now devotedly, and I can't believe it took me this long to get to #101, and boy is this Rails 101!! Another excellent production. I will be using this immediately. Thanks Ryan.

Avatar

Yeay for Rainbows and adorable froggy umbrellas! Have a great weekend!
http://www.arabacar.com/araba

Avatar

Ajax'ifying Rails applications is becoming more and more of a requirement. I have come across this gem/plugin that unobtrusively reconfigures a standard rails view set up to work seamlessly as a single html page Ajax updated, history enabled and crawlable application...

Have you had a go with that yet? I am planning on trying it out, but it would be really interesting to get your view on it!
https://github.com/kjvarga/ajax

Avatar

I took almost an hour to go through each and every comment in here. I would be glad if someone can reply how to handle captchas using Perl. It need not solve captcha by its own but just a way to save the image and send to decaptcha api.

Avatar

Hello,

I haven't used version after
gem 'devise' since it's upgraded since your screencas - was it a good decision?

I didn't have the ControlerError - it is because Rails3 isn't in edge already?

Thanks for great video,
gezope

Avatar

Can you explain the render @products part? I think something is missing in your controller. I looked thru the source code, and I don't see how it could work as is.

Avatar

Nice work, thanks for doing it!

Avatar

Im also using blogengine before and its really pretty cool.

Avatar

@mrbrdo: the .click() call will only work on the first display of the HTML. When those links are replaced via Ajax, the click monitoring will not be active anymore. The .live() call works even if the HTML containing the link is replaced via Ajax.

Avatar

@Richard Leh

New release of rails 3 do not load automatically the .rb files in lib folder. But you can by putting this in your config/application.rb file:

config.autoload_paths += %W(#{Rails.root}/lib)

Reload your server.

Avatar

Just a question... why did you put the partial in the form and the two hidden fields in the partial instead of updating hidden values in index.js?

Avatar

I didn't quite understand why you used .live() instead of .click()? Can you (or someone) explain more in depth?

Avatar

Ryan,

Many thanks for these RailsCasts - they're marvellous.

There are (at least!) two things I'm unsure of with queries.

i) How to do an "OR" query (eg select user where user.id=current_user OR user.parent_id=current_user)

ii) Why are Rails folk sooo anti-SQL?

Avatar

Excellent screencast, thanks!

Eduardo M. - Internal Development
Unihost Brasil

Avatar

Hello,

I would like to return all the comments with the name equal to "test"
When i call Comment.where(:name => 'test').length, it returns 0
When i call Comment.all, it returns 0.

Article.where("comments.name" => 'test') works but it return all the articles contain comment with title equals 'test'

anyone knows how to do it ?

Avatar

How would one go about doing this with HAML?

Avatar

Тысячи товаров на интернет аукционе

Avatar

I think you just blew my mind. Once again Ryan, you make the complex simple and make Rails seem even more like magic. Sure it is, but you make it feel like it is.

ps: getScript == "genius"

Avatar

Hii,

First, this cast is really good!

but, i have a problem with the validator:
---
ArgumentError in UsersController#index

Unknown validator: 'email_format'
---
Do i need include in controller?

this is the path of class: /lib/email_format_validator.rb

thanks

Avatar

Wow, i just wanted to see smtg about search+ajax and here it is!
Ryan great job!

Avatar

Has anyone successfully migrated this Episode (198 - Edit Multiple Individually)example to RAILS 3.01?

I've hit a problem that I'm having trouble resolving - which is basically that the fields_for block is not outputting anything to the _fields partial.

Here's some further details:

http://pastie.org/1304524

Thank you.

Avatar

Ryan,

Cool post. One comment though. Maybe it would be better to use e.preventDefault() instead of merely return false in jquery events, it's more cleaner: http://fuelyourcoding.com/jquery-events-stop-misusing-return-false/ .

Avatar

Nice, I think that you share his becouse yopu like us :P

Avatar

This technique is awesome. Can be used on other languages too.

Avatar

To people having video troubles, I was having trouble viewing this one inside Chrome on my mac. I right-clicked (command-clicked) and downloaded it, then ran it externally in QuickTime Player, and it played fine.

Great screencast, Ryan.

Avatar

@JohnDel: as Phillip state, RJS uses Prototype. But all the cool kids are using jQuery nowadays.

Avatar

@JohnDel: The other issue with RJS (at least when I looked a couple weeks ago) is that it's still hardcoded to use Prototype underneath. So while the rest of Rails is moving towards being agnostic, the Javascript generator helper methods are not...

Avatar

Ryan you are truly a Magister Ludi, thank you.

Since I'm now facing a Rails3 upgrade on a large codebase with inadequate tests, I would offer the suggestion that you might consider using TDD for your screencasts. I have no idea how one might approach testing this.

Avatar

Note to DataMapper users - will_paginate 3.0.pre2 will cause duplicate queries, affectively killing your rails app. I am not 100% sure if the issue is a dm-core or will_paginate but thought I would give a heads up.

Avatar

I'm using searchlogic for all search and also for sorting the results. It has simple helper 'order' that you can use for printing the link as column name and then use for sorting the columns.

Avatar

@Mark - Ryan has said before it is a problem in Quicktime and that he's hoping Apple will fix. If you momentarily pause playback in VLC, the video will catch up with the audio immediately. It only happens when he doesn't type or move the mouse but the screen changes.

@Everyone - I just reported UggOutletTug to Google - that's where they have their email and maybe hosting. Please help stop the spam and do the same with other spammers.