RailsCasts Pro episodes are now free!

Learn more or hide this

Recent Comments

Avatar

Hi Ryan, as always a great RailsCast and a lot of useful information, thanks!

I'm new to Rails and to TDD, I've a question, sorry if it's a little bit off topic: is there some reason for which you created a PasswordResetsController just to send the password reset e-mail instead of just add an action to the Users controller given it's an action highly related to users?

Thanks.

Avatar

some zsh settings break which rake use with caution :)

Also, you may want to use bundle exec rake

Avatar

Any hope of dynamic mass assignment making its way into CanCan? :)

Avatar

We ctually figured out a way. Here's the Gist for those of you needing this:

https://gist.github.com/2006770

Avatar

Ryan, that was a very clear and concise explanation of the problem and a simple solution to the problem. Thanks!

Avatar

I think there are a couple of .js.coffee files that have a .rb extension here.

Avatar

This has been exploding all over the interweb lately. Thanks for the vid!

Avatar

Hum, unless I can't read ActiveRecord::QueryCache, it only clears the query cache if there's an exception, not at every request.

Avatar

Does anyone know how to make the custom login form remember login details? E.g. when I type my email but with an incorrect password it now forgets about the email address.

Avatar

You can simply assign the form to a symbol or string

ruby
= simple_form_for :login, :url => login_path do |l|
  ...

or

ruby
= simple_form_for "login", :url => login_path do |l|
  ...

This provides for your resource object, so the parsed params in your controller will look like:

ruby
params[:login][:username]
params[:login][:password]
Avatar

I enjoyed Railscasts for years, I pretty much learned rails through railscasts. This month I got my subscription to pro. I don't regret one penny.
I guess, in the long run, that's necessary to keep Ryan doing what he does. Advertising financed only gets you so far.

And important episodes, like this one, may help in creating a bit more revenue, don't you think?

Avatar

hello nico,

i solved this issue by deleting the bootstap.js file you don't need it in the sass version .

hope it helps.

Avatar

Just what I needed today - thanks Ryan!

Avatar

Bharat,

Did you implement datatables with twitter-bootstrap?
If you did, can you share with me?

I really like datatables from your link.

Thanks,
Luan

Avatar

Tax deductable if you own a business, or print out the invoice and ask your employer for a reimbursement. Just like David said below, this is one of the few places that I can always find good ACTIONABLE!! content and not feel ripped off, at $9 / month it's cheap.

Avatar

Jeffrey, It's well worth the Money. Could you think of a better investment? Either your career or business will love you for a railscasts subscription.

Avatar

Although this is a revised episode (and therefor subscriber only)
it is really a rather important one given recent events.

What about, this one time, making it a normal video and free to all to view?

Avatar

This is not the first time that you mentioned this, as i remember you always use point this, your nifty-generators are the best example, thank you Ryan you are the best rails teacher!

Avatar

Aha, very nice
I just rebuild my models with 'attr_accessible'
I was also just know that 'attr_accessible' is so important

Avatar

Nice one Ryan - I blogged something similar a few days ago too (it includes DHH's example on how he deals with MAS as well) http://astonj.com/tech/rails-mass-assignment-security/

Avatar

Ryan, very useful as ever! One thing I noticed is near the end you mentioned about Dynamic Attributes covered in episode 239, it's actually episode 237 - thought it worth a mention :)

Avatar

So gon did work for jruby. and I can alert the gon object from inside my coffeescript as a string. But when I assign the gon object(which is a json object) to my map, it does not pick up the data. I tried using the javascript tag and send a json object in the same way, and that works !

Avatar

I've started work on a JSON api for split, in the form of another small, mountable sinatra app, the code is here (unfinished): http://github.com/andrew/split-api

This will come with a javascript library for easily doing split ab_tests in javascript.

Avatar

Great screencast. Thanks!

A quick note: the close box on the alerts is not working (using Rails 3.2.2).

There's a small typo in the ASCII-cast; the anchor link for the close X is not ... closed with :-) But that didn't fix things.

Some have said this is because you need JQ 1.7, so I updated Gemfile to gem 'jquery-rails', '~> 2.0.1' and while the new jQuery is loading, the problem still exists.

Avatar

Similar to Vincent, I'm looking to use something like this to track in-page actions. I'm imagining that the solution will be to fire an AJAX hit back to the site to an action which triggers the conversion.

Avatar

How can I add my own icon sprite? I see we're setting the variable here:
@iconSpritePath: asset-path('twitter/bootstrap/glyphicons-halflings.png');

However, where in my project would I put my "icon-sprite.png" file. There's no twitter/bootstrap folder anywhere.

Thank you.

Avatar

I've been using this gem for a while and it's awesome!

Avatar

And if you decide to use Twitter Benchmark, it includes a number of mixing similar to those found in Bourbon.

Avatar

I'd love to use this in a JS frontend with a rails backend. Is there a way or what would be the best way to implement it?

Avatar

The Asciicast has an error on 'adding a navbar'

The class data-target is shown as ".collapse" rather than ".nav-collapse"

Avatar

I think the short variant of form won't work since there should be password confirmation validation in the model.

Avatar

Ah, this time you're 2 days late! I used it earlier this week and is great tool indeed. Customer happy that they can do A/B testing and stop/restart testing sessions themselves, which is a relief also for me ;).

Avatar

Compared to Compass, which one is better?

Avatar

Correct, it has to go into 'onload' -- you can't just slap it at the bottom of mercury.js anymore

Avatar

Hi Ryan,

I loved the mobile MIME type solution but was wondering why I might be getting a 406 error when I attempt to access content with UJS in a mobile device. I'm a beginner and I haven't been able to find a solution for it yet, though it seems a few others have similar problems.

Could you perhaps shed some light or point us towards a solution?

Thanks!

Avatar

I'm seeing this with the Compass gem as well. I think it's a sprockets limitation.

Avatar

I am having an odd issue in Develoment: In order to make Sass stop throwing expections about 'Undefined mixin' I have to use @import "bourbon"; on EACH stylesheet. What would be causing this?

Using Rails 3.1.

Avatar

Well this is support for people who don't update their browsers.

Avatar

Small hint: It's not really necessary to use browser prefixes for border-radius anymore, since in January 2010 (Chrome 4), in June 2010 (Safari 5) and March 2011 (Firefox 4) the prefix was dropped. Opera and Internet Explorer never provided a prefixed form. Could save you some bytes in your CSS.

You also might want to use -prefix-free.js, a 2K lib which let you use the unprefixed stylesheets and rewrite them as necessary. http://leaverou.github.com/prefixfree/

Avatar

I'm confuse, is this like compass?

Avatar

I'd really like to see a COMPASS introduction, too. In particular I'm having trouble to setup image sprites...

Avatar

I've just released the new version of Split (0.4.0, https://rubygems.org/gems/split/versions/0.4.0) that contains the new config option that Ryan mentioned that helps to avoid users participating in multiple experiments at the same time.