RailsCasts Pro episodes are now free!

Learn more or hide this

Recent Comments

Avatar

Ryan, thanks for all the screencasts. I found them very useful.

I have a question about tire/elasticsearch working with ActiveRecord. Your episode talked about using a filter to put constraints on the records. I was wondering if it was possible to combine tire/elasticsearch with scopes. E.g. in the show notes, instead of using a filter to filter out articles not yet published, would it be possible to use an activerecord scope on Article

ruby
scope :published, where("publish_date <= ?", Time.zone.now)

?

Avatar

As usual thx Ryan!
I think this is a really interesting screencast about rails and its environment.
Recently I switched from Rails to Playframework (Java) for most of my projects. Did you ever think about making screencasts for other frameworks as well?
Railscast is a really valuable resource for rails and it would be great to find something for playframework as well :D

Avatar

Am I missing something or does the Homebrew install need Ruby, which you then go on to recommend installing using rvm?

Avatar

Thanks for this very nice and clean tutorial.

If you want to add a delay to the search to avoid overloading the db, an easy way to do it is by using the jquery.observe_field.js plugin and changing the search script to:

$('#keyword').observe_field(1, function() {
    $.get($(this).parents('form:first').attr("action"), $(this).serialize(), null, "script");
    return false;
});
Avatar

may I suggest changing the line: local recent=$(ls -t .rake_tasks~ Rakefile */.rake | head -n 1) to local recent=$(ls -t .rake_tasks~ Rakefile */.rake 2>/dev/null | head -n 1)

It removes error output for .rake_tasks~ not existing.

Avatar

Thanks a lot for doing this episode.

I'm having a few problems implementing this.

Can you elaborate on how you got this working for rails 3?

Thanks!!

Avatar

I found the solution, added omniauth-facebook, run bundle install, and it install something that omniauth-twitter does not, and then omniauth-twitter works fine.

Avatar

I'm also facing problem with starting application after following the instruction. By the way, the omniauth has some new version, but I had added "omniauth-twitter" to gem file, and bundle install as follow:

Installing omniauth (1.0.1)
Installing omniauth-oauth (1.0.0)
Installing omniauth-twitter (0.0.7)

But when start the app it display the following error:
dependencies.rb:239:in `require': no such file to load -- multi_json (LoadError)

What is the problem here ?

Avatar

I wished I could find out your comment about 6 hours ago. That the amount of time it took me to figure out the solution.

Avatar

How about using normal edit form and style out of focus inputs to resemble normal text (without borders etc.)

Avatar

This seems to work perfectly when testing through browser with mobile user-agent locally, but when I push it live, first request renders full site, and second one from there only takes me to mobile page.

This doesn't happen always, but very often. Anyone else having this problem? Any idea why?

Avatar

An1 tried it with simple_form , i suppose that is the error that i am facing

Avatar

Getting missing partials in rails 3.1 and the error points to missing block in

ruby
fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder|
            fields = render(association.to_s.singularize + "_fields", :f => builder)
 end

Any clue as to why this is coming ?

Avatar

Can u post ur code for 3.1 ? i seem to be having some problem with this lines:

ruby
fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder|
  render(association.to_s.singularize + "_fields", :f => builder)
end
Avatar

Did you find a solution Troy?

I like Active Admin a lot so far but haven't been able to find any info on editing passwords.

Avatar

Please redo this for Rails 3, even adding in namespace help too would be brilliant! Struggling with this at present...

Any help would be appreciated

Avatar

Hi Ryan,
i've installed your dot files on my other machine the other day. The plugins dir does nit seem to be loaded. Where shall i put my custom plugins?

  • Kai
Avatar

Very cool for some things. Can't forget to try to DRY code out instead of just generating it, though. Good choice of an example though -- redoing my standard layouts each time I start a new project gets frustrating after a while. Thanks!

Avatar

It's amazing how much I learned from this episode, for instance, I had no idea why we were submitting the hidden field for checkboxes; I also totally forgot about the dom_id method, and have been hacking id's together. I think I have some refactoring to do.

Thanks Ryan for an awesome year of Railcasts. Happy Holidays and all the best for the New Year!

Avatar

Just a quick update: the two problems with the save event not getting fired and image drag&drop not working will be resolved if you update to the latest version from the git repository. (http://jejacks0n.github.com/mercury/) Note that you will have to rename your table to mercury_images instead of images if it already exists.

Avatar

Same issue here. Did you find a solution to this problem?

Avatar

Can somebody give an example of how to use type :date? Is there a way to format the display? I'd like to pick the day/month/year without any time elements. When I use

<%= best_in_place @class_time, :completion_date, type: :date %>

the field is not editable

Avatar

Me too!!

I would love to see a wizard episode + the integration of a "Devise registration step" in order to see how to customize Devise with this and how to create a multi-steps form with multiple forms.

Thanks!

Avatar

When I use radios and checkboxes I generally wrap the input and text in a label tag. I like it because it increases the clickable area for a more comfortable UX. (http://dabblet.com/gist/1515022)

Avatar

I've just come up against this issue too. Does anyone have any ideas?

Avatar

I agree. Multi Steps Forms re-factored would be nice. BUMP :-)

Avatar

Instead using <%= hidden_field_tag "product[category_ids][]", nil %> i used in my controller update action something like this:

ruby
params[:product] ||= {}
params[:product][:category_ids] ||= []

This works fine too! :)

Avatar

How about following up with a series of screen-casts using Simple Form gem? I have used it in the past and the current project and find it extremely useful. Moreover, the PlataformaTec crew manning the Google Group is super helpful. I think a set of "Professional Screencasts" on Simple forms where you go deeper into the subject matter just as you did with z-shell will be very useful.
This screencast was great. Keep up the good work.
Bharat

Avatar

Hey Ryan, Merry Xmas from a Rails noob. This and Autocomplete revised was the two episodes that made me decide to subscribe too.

Just wanted to let you know your railscasts was the thing that really cleared up my RoR concepts, it's just awesome visual learning by example. Thanks!

Avatar

wow , i didnt know about dom_id, you know how many places have used interpolation instead?... :(

=D good thing i learned this , thanks Ryan.

Avatar

Two quick comments:

1) If I try to reindex my objects, rails throws the following at me:
rake aborted!
undefined method 'paginate' for #<Class:0x00000106e32310>

I'm using Kaminari, so maybe it's because of that.

2) After including query do and boolean do I don't get any of my objects shown. Neither with nor without search term. I also don't get any errors, they just don't show up.

The first one is not a problem, but the second one really bothers me, so any help would be appreciated.

Avatar

yes it worth it, thanks ryan for your contribution and waiting of the refactoring of the episode "multi-step forms".
I wish you all the best
Rash

Avatar

Hey guys,
I spent about 6 hours stuck on getting Rmagick to work on OSX 10.6 and wanted to share my solution to maybe help at least somebody out there. Pretty much, I used homebrew to install Imagemagick but with a special way to avoid a bug I kept running into: http://stackoverflow.com/questions/2838307/why-is-this-rmagick-call-generating-a-segmentation-fault/8614289#8614289
(if you're using Macports, I feel sorry for you; definitely use Homebrew. Life is much, much easier)

Also then install the Rmagick gem. And things should be good to go.

Thanks Ryan for the great Railscasts as always.

  • James Fend
Avatar

Hi there,
My Term stays white backgrounded, colors change, but not all,
only if I switch the theme in OS X Terminal Settings to another term,
then the theme switches to the text and terminal color of OS X choice.

anyone knows, why colors are not switched properly?

Avatar

Using the hidden tag set to nil didn't work in my rails project. It might have to do with the fact that I'm using the Mongoid ODM. I found that unless all the values in the array are valid ids, nothing will change. (I suspect that ActiveRecord just ignores any non-valid values.)

To combat this issue, I set my hidden tag to a string like 'included'. Then in the controller, I used the line

params[:product][:category_ids].delete 'included'

I'm not sure if this is the best solution, but it works.

Avatar

Subscribing is totally worth it. I swear that last night I was literally looking on how to do this in Rails. Then bam. Next day here it is.

Avatar

I literally did this yesterday. I will finally subscribe just to see if we did it the same way.

Avatar

Anyone having issues with vim and gui mode?

When I open vim in terminal it says:
CSApprox needs gui support - not loading

Any idea how to make it with gui support?

Avatar

I've been using zsh for about a year, and recently tried writing my own compdef scripts, but got bogged down in the docs. This screencast has really helped things click in my mind. Thanks, Ryan!

Avatar

If your name isn't Clemens, you should use the generic form :)

if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then source "$HOME/.rvm/scripts/rvm" ; fi

Avatar

I also got it working, but Rails can't recognize dates anymore:

"Object must be a Date, DateTime or Time object. "2011-12-22" given."

But as you can see, it is in the normal date format.

Edit: Found the error myself. Rails wanted an extra ".to_date"