RailsCasts Pro episodes are now free!

Learn more or hide this

Recent Comments

Avatar

Champion. Perfect timing for Rails Rumble.

Avatar

Just watched Pt. 1 and was hoping you'd release Pt. 2 soon... I didn't expect it to be THIS soon (one refresh away). Thanks so much, you rock!

Avatar

Really really nice! I like the conciseness in generating forms; the errors right next to the fields(!);

Avatar

Thanks for this article, it certainly helped me in deciding the best way to implement many-to-many relationships

Avatar

Thanks Ryan for the post. As always I love your screencasts, easy to follow.

Avatar

I only want to crop the thumbnail and leave the original :large as is at 800x800>. Any ideas how to do this? Been staring blankly at the code and doesn't seem any obvious way to parse this info.

Avatar

auth = request.env["omniauth.auth"]
works for me. Why should we use ["rack.auth"] ?

Avatar

I was trying to use the new respond_with way of handling the restful responses in various formats, but I always was getting the same html thing....

The problem was that:

I had in the first place named the view template index.rhtml instead of index.html.erb.

Without the proper naming all the times the template was rendered not just for html.

Any way, thanks for the great screencast.
Juan.

Avatar

@Joseph: Right, of course a choice of providers should be presented.

In your example, a user login with facebook and come back 3 weeks later:

1) User is still logged in with facebook (not sure how these things expire, if at all?), all is good and the user can go on with their business.

2) The old authentication has expired/been removed, the user is presented with auth-choices, facebook, twitter, openid etc and use one to login.

In either case I fail to see the need for the user to has_many :authentications (one would be enough?)

Avatar

How to migrate the _data_ with mongodb? Although I dont need to modify the schema anymore I have to adjust the data from time to time. Is there a mechanism to collect such "db-patches" which can modify existing data in a comprehensive manner in the different environments?

Avatar

I get "OAuth::Unauthorized" when I go to http://localhost:3000/auth/twitter

When you setup the twitter application, what do you put in the fields?

Avatar

@ippa, I think it's more so that the user doesn't have to know, care or remember which provider they signed in with, like so that they can login with Facebook when they first come to your site, but when they come back three weeks later, they may not remember that they used Facebook and so they attempt to sign in with Twitter.

Avatar

Thanks for the podcast. I was hoping that you would have covered nested forms with Simple Form. I haven't found any documentation about how to handle that. I guess I could read the source.

Avatar

Great episode, interesting stuff! A question, when would you need a user to login several times with different providers?

Wouldn't it be enough if the user logged in once with one provider?

Avatar

How do we handle the errors or cron job failures? SO that if something fails we will know.

Avatar

Good job,nice blog.I think i'ts very wonderful

Avatar

@Ryan

Although I think you'll see Mr Bates demonstrating how to create a new account based on an external login in the next episode, or something similar. That should satisfy your needs too. Ryan's approach will probably have a little more flexibity than mine insofar as it looks like he'll allow multiple external logins to connect to a single account.

Avatar

@Ryan

Yes, this is how OmniSocial works, and it's definitely possibly in OmniAuth: I couldn't have built this little engine without it. With OmniAuth, you have the flexibility to make it work however you like. With OmniSocial, I've shared the way that works for us.

I could definitely add Google Auth support. I'll see if I can add it in the next couple of days.

Avatar

@Tim

This sounds like exactly what I need. Have FB or Twitter *be* the login, not link an existing account. Any plans to add Google support?

Is this also possible in OmniAuth?

Avatar

Hi Ryan, thanks for this video! OmniAuth is a great system. We've just put it unto use for Twitter and Facebook logins on our Rails Rumble app from last year, Decaf Sucks (http://decafsucks.com).

I've extracted this code to make a gem called "OmniSocial" that provides a simple and completely functional out of the box setup for logins using Twitter or Facebook. It might also come in handy for the Rails Rumblers this weekend.

You can check it out on GitHub at http://github.com/icelab/omnisocial, and also read some installation instructions on our release announcement: http://icelab.com.au/s/238

Cheers!

Avatar

Nice stuff, Ryan. One of the things I love about your previous podcasts was the keystrokes in the top right hand corner of the screencast when you were in textmate.

Avatar

Furthermore you said that you can't do much about buttons looking as buttons? Thats not true at all.

a form,
a form input,
a form button {
display: inline;
margin: 0;
padding: 0;
/* more */
}
a form button,
a form input {
color: blue
}
a form button:hover,
a form input:hover {
text-decoration: underline;
}

Avatar

Oh man, Ryan do something against the spam, it degrades the comments feature almost to be nonworthy ;)

Then: Thanks for all your GREAT work, it helps me a lot.

For this episode I have some criticism though: I think using button_to is just fine and no where ugly.

If you really want a confirmation then your link_to with confirmation page is great, but if you do not require a confirmation for graceful backfalls then button_to just fits perfectly.

The paradigm of using buttons where data might be modified and using links where data is merely returned to the user is rather transparent.

Avatar

This is the real definitive guide to auth systems!

Thank you, really.

Avatar

Thanks Ryan, I love your shows. I was just about to start working on the same (integrating OmniAuth with Devise) but you(ll help me a lot forward with these screencasts!

Avatar

Thanks Ryan, very interesting

Avatar

Actually, that is not a real issue, so apparently I don't know what I did to resolve my issue.

In all likelihood it was the timing of when I restarted WEBrick that made me think that was it :)

Avatar

One of the best Rails resources around!

I had a problem getting an e-mail to send until I changed:

:port => 587

to

:port => "587"

Thanks Ryan!

Avatar

Hrmm that was weird, my comment got eaten. Anyway I wanted to say that its nice to know that someone else also mentioned this as I had trouble finding the same info elsewhere. This was the first place that told me the answer. Thanks.

Avatar

Clearly saying thank you is not going to just be sufficient, for that amazing lucidity as part of your writing content articles. I will swiftly consider maintain of your rss feed to remain abreast of any updates.Genuine work and considerably becoming effective within your efforts and world wide web enterprise tries.Regardless protect up the helpful purpose.Thanks.

Avatar

it's a good application. Thanks.I am hoping the same best work from you in the future as well.

Avatar

How would you go about to enable access to 'params' array, in order to change behavior?

As ever, enjoyed your cast.

Avatar

Are you still using Akismet? It's not working very well is it?

Avatar

Nice. Do you think you could add how to dynamically change the number of records shown per "page"?

Avatar

Nevermind that last comment. It wasn't persisting between cucumber sessions, but rather across scenarios when I thought it was reset for each. Read more about transactions and before/after hooks for info.

Avatar

Is there a way to reset the FactoryGirl sequence? It seems to persist between cucumber sessions which breaks my tests!

Avatar

Anyone using serializers? I can't get them to work. Active Model is great but need some more polishing in my opinion.

Avatar

Chainging isn t so Ok. Maybe do something else. It is more secure.

Avatar

I have a newbie jQuery question to go with this. I have a select in my nested model which does a find. I want the conditions of that find to be based on a previous field in the form. Is there a way to either set an instance variable in the controller with jQuery or use it inline to refer to that select, like
$('#selectList').val();?
Thanks in advance.
Brian

Avatar

great gem. I prefer to write the links a little shorter:

<%= if can? :update, Article then link_to "Edit", edit_article_path(article) end %>

Avatar

I do envy you since you seem to get a lot more comments then I do.

Avatar

This is my first time visiting your blog.

Avatar

When I do put *gem 'fastercsv'* in Gemfile and require it in file by using *require faster_csv* it works fine.

But, I wanted to add fastercsv in Rakefile, jeweler gem dependency:
*gem.add_runtime_dependency 'fastercsv'*

When I do bundle install now, the gem is not installed as the actual name of gem is different, i.e. 'faster_csv'.

@Ryanb, how to require such gems with 2 names in rakefile?

Avatar

I am using rails3 with jquery. I got it to work by copying and pasting Ryan's code to avoid typo and changing the variable to match my paperclip model for adding more than one image to the parent. After the cut and paste I can remove, but had trouble adding.

1) per artyomst, I got adding new field to work, but the fields were in the wrong location.

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

2) per Michael Pope, I modify the jquery script to,
$(link).before(content.replace(regexp, new_id));

Now it seems to work, I can add and remove new fields that gets saved.

Thanks,

John

Avatar

just passed this onto a colleague who was doing a little research on that. And he actually bought me lunch because I found it for him smile So let me rephrase that

Avatar

How about paperclip?
How do I manage to get them working together?

Avatar

I need to see the code in order to determine what's wrong. But here's not the best place to post that. InsteadI recommend making a thread over

Avatar

I really enjoy your railscasts, and I'm learning them one by one from the beginning these two days