RailsCasts Pro episodes are now free!

Learn more or hide this

Recent Comments

Avatar

Ryan, you definitely read my mind, I was actually implementing a proof of concept of an offline app using HTML5 manifest and Web SQL database, that will definitely helps ! thank you so much, keep up the good work

P.S. : will part 2 talk about Web SQL database ? :)

Avatar

Nice one! I'd also be interested in learning a technique to handle updates done offline. I e offline/online syncing.

Also, I was thinking about a way to force the manifest to reload. How about adding a field to the user model (assuming we're working on a multi user app) called manifest_version. Then for each create/update or destroy this version is increased. Further a new view is created that simply renders this version. The path to this view is then added to the application.manifest. Upon reloading the manifest the browser should then notice a change in the manifest and the new manifest would be loaded. Am I making any sense here? :)

Avatar

MongoDB great - could we see a post on Mongoid? Thanks for the great work!

Avatar

The cache-busting timestamps on asset files are there for a reason. What are the consequences for the rest of your app when you just get rid of them like this?

Avatar

Hello Ryan, thanks for another excellent Railscast.

One question, the problem at the end can`t be addressed with a cache sweeper?

Avatar

Great and simple railscast and a nice way of auth, I've follow this one but I'm using MongoDB, and Heroku + MongoHQ with Twitter API.

I'm having a problem when another developer forks que app and runs it and also when it runs in Heroku, It's not saving the user data to the database thus not showing the name of the person and each time he wants to log in it creates another empty user.

Can some one help me?

Avatar

Thanks so much for the fantastic tutorials. Probably a dumb noob question, but how do you update the sections you want to protect when you add Omniauth to Devise? In the Devise app, the password protection was done by placing the "before filter" in the controllers for the sections to be protected. I didn't see an analogous line in the project or task sections in the source code for the new version with Omniauth. In my app, my links are properly going to the new login with Twitter Omniauth page, but the default password request is still going to the Devise password page, not the new /auth page. How does one update this?

Avatar

can anyone tell me what if delayed_job stop and start working next day then how I will figure out the missing date mails or documents ...etc..

Avatar

Is there any reason why Thinking Sphinx would not read the config/sphinx.yml file? I'm using Sphinx 0.9.9 and Thinking Sphinx 1.3.16 (because I'm stuck with a Rails 1.2.6 app). Thank you for any suggestions!

Avatar

Thanks for the share! It's a very useful post. I already used it.

I created a post based on this post, to demonstrate a sample Rakefile to use with this Railscast

http://pablocantero.com/blog/2011/01/02/new-gem-with-bundler-sample-rakefile/

Rakefile
https://gist.github.com/762965

Avatar

Does the back button in this example also work to get back all the way to the initial non-ajax load of the page? I had to add the state for the initial page load after the first ajax call using the replaceState function to get it working. See my blog post mentioned in my previous comment for details.

Avatar

I posted about this as well here a while ago: http://www.railstoolkit.com/posts/html-5-ajax-history-and-adress-bar-integration

Avatar

thx a lot for this.

How about an "edit multiple records in one form, without checkboxes"?!
Using your products example.

thx!

Avatar

Does anybody know how the authentication problem can be solved when using Phusion Passenger?
 Every couple of weeks, I face this bug that doesn't let me to login when using IE! Strangely enought, it works fine other times!
Thank you very much in advance!

> Joshua Jul 16, 2008 at 01:08
> If you're having troubles with
> getting HTTP Basic
> Authentication working with
> Apache fcgi try adding this to
> your htaccess file.
>
> RewriteRule ^(.*)$ dispatch.fcgi > [E=X-HTTP_AUTHORIZATION:%
> {HTTP:Authorization},QSA,L]

Avatar

In HAML/Rails3...

%title<
  Shopper - #{ content_for?(:title) ? yield(:title) : 'The Place to Buy Stuff' }

Avatar

Ryan: I tried setting up an application on Facebook and using the code from the railscast. I'm getting an OAuthException: "Invalid redirect_uri: Given URL is not allowed by the Application configuration."

Did you have to setup something special for testing from localhost?

Thanks.

Avatar

Do you have directions how to transform the URL address generated like this from:

http://domain.tld/products?direction=desc&search=dj&sort=title&utf8=%E2%9C%93

... to:

http://domain.tld/products/search:dj/direction:desc/sort:title

Do I need anything else besides rails3 router + changing the form input serialization to return slashs and colons instead of ampersands and equal-signs?

Avatar

I really like the approach, funny enough I have figured out how to use the latest jquery-bbq over the last 3 days.

I will convert the app to this approach, it will be nicer with slash-URLs and without a # anyway.

BUT: for those who need FF3/IE-support:

Full blown: https://gist.github.com/755139
Reduced FeatureS: https://gist.github.com/757510

Have fun :)

Avatar

If you want to backport support for legacy browsers have a look at: https://github.com/fortes/history.js

Avatar

This was very helpful. I did have an issue with signing up for Rubygems -- I get an internal server error when trying to create an account. But otherwise, a great intro and it inspired me to create my first gem.

Avatar

@gavin

thanx, now work PG

Avatar

I just open a issue, about this problem when register with twitter, and then try to login with email and password.

BCrypt::Errors::InvalidHash in Devise/sessionsController#create
invalid hash

If someone have a idea ?

https://github.com/ryanb/railscasts-episodes/issues#issue/3

Thanks,

Avatar

Nice One
A newbie question here
How can I do the ajax part for my rails 2.3.8

Avatar

As soon as I posted (#75) I realized the answer...at least one way of doing it. All I did to get the formtastic date field to default to today was to specify it in the new action. In my app it looks like this:

def new
@flight = Flight.new( :flightdate => Date.today )
end

Avatar

Hi Ryan -
I notice that your born_on date field displays the current date by default in your app while using formtastic. My app doesnt do that.... I've added:

def after_initialize
      @flightdate ||= Date.today
end

to my model...but, I can't get my f.input :flightdate to display today by default...its just blank.

What can I do to make the formtastic date fields display today by default? Why did your app work as expected?

Thank you for all that you do! Your screencasts are invaluable. And, thanks to Justin too for creating formtastic...it is awesome.

Avatar

As html-<form>s may not be cascaded (e.g. you cannot put a <form> within a < form>) and I am using button_to for my destroy actions which generates forms I had to work around the input fields not being inside the table as I would have form in form then. this is my solution:

https://gist.github.com/754999

e.g. I just do two updates / insert two partials using jQuery

Avatar

I just wanted to say...
... i love you :)

thank you SOO much :)

p.s. please add some episode based on this one that adds jquery-bbq - I can'T make it work for hours!

Avatar

Very good and useful.Thanks.

Avatar

Ryan,

Short and simple is *great* when it comes to such a universal need as this. This has been one of my favorite 'casts in a while (along with the OmniAuth one) and I'm /sure/ I'll be using it within the next few months.

Thanks!

Avatar

Thanks, Ryan!

In case anyone might be interested, to complement the `bundle gem` approach (more generally, the approach of making the gemspec file authoritative), I've put together a small collection of Rake tasks (clean, compile, cucumber, rdoc, ronn, test), that look to the gemspec, .gitignore, cucumber.yml for their configuration:

https://github.com/matthewtodd/shoe

(Perhaps it needs a rename -- "shoe" shares form with "hoe" and "echoe", but it also sounds too much like _why's Shoes.)

Avatar

Pretty succinct.

You might also want to look at using Ore (http://github.com/ruby-ore/ore#readme) which stores all project information in a single YAML file, inferring the rest.

Unlike Jeweler, Ore does not regenerate any files or make commits for you. Unlike Hoe, Ore does not need to keep a Manifest and does not add itself as a development dependency. Ore works fine with Bundler and can even be used with Jeweler::Tasks.

Avatar

Ryan,

Thank you. I am just getting back into coding. Your railscasts makes it fun and easy.

Joel

Avatar

Nice work again Ryan. Just thought of an idea for an episode for you:

Making the number of items on the page with will_paginate dependent on css3 media queries? Seems to be a good idea to me - if I am on a mobile browser I might only want to see one item on the page, but if I am on a large screen I might be able to see ten or more.

Avatar

I was just looking for some information on how to put together a Gem so this is great! Also I noticed that the "Full episode source code" doesn't appear to point to the correct location.

Avatar

I had to change a little the link_to_function call in ApplicationHelper

      link_to_function(name, "add_fields(this, '#{association}', '#{escape_javascript(fields)}')" )

notice the change from \" to ' ... otherwise they would be converted to &amp, and not a javascript string delimitor.

Rails 3 & jQuery here.

Great post anyway !!

Avatar

I like that you import info from github. FYI: The link to the website prepends http://railscast.com/users/www.rorecommerce.com

Avatar

Wonderful Ryan. It's a great idea to revisit old topics showcasing the new improved ways to do things.

Avatar

Nice episode, Ryan. I still prefer Jeweler, though.

Avatar

I agree with riccardo "I can authenticate against Google using OpenID but I do not get the access token, just the uid, so I cannot query any service to get data form Google. I need to get user's contacts"

Avatar

Thank you, very nice. However, some files can not be displayed on your website, be aware of.

Avatar

Hi Ryan, Your iniciative is awesome, keep up the good work. I see, somethimes You don't have an idea of a useful screencast, maybe a voting script on your site with topics will do the job ? I would also suggest you more screencasts about testing techniques with examples. Regards

Avatar

Hi .. Superb blog post, I have book marked this internet site so ideally I see much more on this subject in the foreseeable future ! Very Good .. http://iqwfg.com

Avatar

It is so lucky to read your blog,it is full of useful message.I wish we both can do better in the future.It great honour if you can visit our website,and give us some suggession.

Avatar

I resolved my own issue, turns out that I had somehow created a 'twitter' authentication that was useless at some point. Thus then the sign_in_and_redirect function was called, it was trying to append a non existing user!

DUH! It only took me a few hours...

This is great though thanks!

Avatar

Looks like it's a problem with Windows, where OmniAuth (or ruby) cannot find root certificates. No clue how to solve that yet.

Avatar

To 43. zhubo:

You don't have to remove the respond_to block.

Just add another responder in there to respond to javascript like so:

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

Avatar

I'm having a problem with SSL after following the railscast. After clicking on login via facebook, on the return call this error happens:

OpenSSL::SSL::SSLError
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

I've seen people say this is due to ruby 1.9.2, and downgrading to 1.8.7 would help (I don't want to), and some have posted a "faraday hack" to this which I can't get working.

But I'm thinking this is a configuration issue more than anything. Does anyone have a clean fix for this?

Avatar

Thanks a lot Ryan for the smooth introduction to Prawn. I just needed a start for pdf creation!

Avatar

why not to use retry within rescue block?