RailsCasts Pro episodes are now free!

Learn more or hide this

Recent Comments

Avatar

Such an inspiration

Avatar

Cool!

How about a Railscast about "normal" edit forms for several model objects on the same page. Like this one, but allowing you to change multiple product names at the same time.

Avatar

Sorry about the downtime guys. Everything should be up now.

Avatar

The m4v version is up now.

Avatar

I too am unable to view the Railscast via download link on Safari or save file as or even the iPod link.

As Brian said above "Thanks for making Monday mornings NOT suck" - I second that.

Avatar

Sorry about that guys, forgot to upload the iPod version. I will do it shortly.

Avatar

Can't use the download link nor iTunes to download this (fantastic looking) podcast.

Please fix it. :)

We need you and your podcasts!

Avatar

I really look forward to your Monday morning Railscasts. Thanks again Ryan. I can't wait to watch this on my break this morning.

Avatar

is there any reason why this wouldn't work in 2.x? i've tried doing this on one of my new apps, and it just doesn't seem to work. i don't get errors, or exceptions, but it's not functioning like the screencast.

I can login but when i do it doesn't show me the administration links (edit, destroy).

I'm going to look at the code again and compare it to what's posted.

Thanks,
John

Avatar

This is great! I've, up until now never really had the need to use repeating background processes, however, I was, just for fun, looking to see if anything existed for when I really needed it. (which I do with a lot of Rails stuff!). Sadly, I was unable to find anything for months, and then this screencast comes out. With a gem that allows you to write "Ruby" syntax to create "cronjobs"? Excellent! Being able to do that kind of important processing with such an easy syntax is extremely useful and saves a load of time, not to mention that it saves a lot of hassle for every deployment and/or server transfer. Also the fact that the server triggers it every time means that it's actually very light-weight compared to (which I never got working properly), other daemon-like gems!

Thanks Javan! I'll be watching you on Github! :)

Avatar

Total awesomeness!!!!

Avatar

Webrat is the best!!!

Avatar

Thanks for making Monday mornings not suck.

Avatar

Hi!

I agree with Richard, I have a 404 on the ipod version?

Regards,

Avatar

Hi Ryan,

It seems that there's a problem with the iPod version ?

The requested URL /ipod_videos/165_edit_multiple.m4v was not found on this server.

Anyway great work as ever !

Bests,

Avatar

Many thanks Ryan, great screencast as always !!!

Avatar

Another great screencast! This is the first thing i do on Mondays. Love it!

Avatar

Great video as always.

I'm having trouble getting the crontab to write the crontab with a Capistrano deploy to EC2. While it's deploying it tells me that the crontab has been written, but when I log in and run crontab -it's still the old crontab (previous Capistrano release). I have to then manually run whenever --write-crontab. And then running crontab -l shows the correct release.

Does anybody have any ideas on what could be causing this? I have tried a million variations and nothing seems to be working.

Avatar

Thanks Ryan, writing rake tasks is so easy!!! :-)

Avatar

@Tom

class A

  def my_attr
    'hi'
  end

  def to_xmo(*args)
    super do |xml|
      xml.my_attr my_attr
    end
  end
end

Avatar

Ryan-

I've now watched this and your cast on the daemon gem and I'm confused on what you feel to be the best practice.

Let's say you need to set something up to basically continually poll your database to see if their are any new emails to deliver, or whatever. Would you use a cron job or would you use a daemon? Would you actually run it from the job or would you hand it off to something like BJ to run so the scheduler can continue? What if you have a variety of things that need to be checked, like checking for new mail from a server every 10 minutes, sending alerts every 2 minutes, pulling data from a web service every 5 minutes, etc.

I can't seem to find anything that addresses the best practice for something like this in rails.

Avatar

works fine for me by setting the correct route in routes.rb.

sample:

map.tags '/tags/:js', :controller => 'tags', :action => 'index'

(tags are what categories are in the example above)

Greets, Jens

Avatar

Fantastic idea. It's one of those things were "there's gotta be a better way" ... and this is it.

I recommend those who aren't so hot on their "partials" to look at this:

http://guides.rubyonrails.org/layouts_and_rendering.html#rendering-collections

... at least, if you're like me and that "so let's render a partial" made you go "whoa, WTF?",
then the above link is for you ;)

GaJ

Avatar

If you wanted your textmate bundles to make your prawn files all preaty to look at then here is what you need to do.

Goto bundles/bundle editor/show bundle editor note that is not a file path that is the path to the bundle editor when in text mate.

after that you just need to go to ruby tab and go all the way to the bottom until you see the words ruby. Just click it and then you will see the mountain of text that you can edit.

Edit this peace "fileTypes = ( 'rsel', 'rb', 'rbx )" so that it includes the file extention of prawn.

fileTypes = ( 'rsel', 'rb', 'rbx', 'rjs', 'Rakefile', 'rake', 'cgi', 'fcgi', 'gemspec', 'irbrc', 'capfile', 'prawn' )

Avatar

I've built about 5 different helpers for different clients that do this. Then I started watching railscasts. Thanks for the great content. I've summarized the behavior on my website so I have a quick reference.

http://rails.lostjungles.com/content_for-multiple-yields-in-the-same-layout/2009/06

Keep up the great work!

Avatar

how can i click a button when dialog shows during test? example: when deleting element dialog shows to confirm this action, is it possible to test it with webrat? if yes, how?

Avatar

Hi Ryan, This is a grt screencast. I tried it out and everything works besides one thing, which is adding new task. I can edit the task, i can delete the task but i can not add a new task. All the code is the same as shown in your screencast...any reason why?

Avatar

Got the "register | login" working great on my site, until I added before filter to each controller to require a logged in user (following the example from the authlogic/github tutorial) Now, when logged in user, views show as expected, but "current_user" is nil causing the "edit profile | logout" code to be ignored, and the "register | login " to display, however I have a current user object or the view would not display??? newbie needs help.

Avatar

This is a wonderful screencast but I would love it if you could dig a little deeper. As soon as I try to use it for myself I hit walls such as, how do you match '/charts/3/observations/new' in paths.rb when the 3 is dynamic?

I run into similar problems when I try to use Factory Girl with anything more than a trivial association.

Would you consider a 202 level screencast for cucumber and Factory Girl?

Avatar

Nice exhibit, Ryan. My question is how you handle the delete of the respective reciprocal friendship? I've found that to be a case where the :after_remove option on the has_many has failed me, and I had to resort to some kludges. I wonder if there is a clean(er) way? You don't cover that part.

Avatar

I downloaded the episode's code from Ryan's Github account however as soon as I initialize the server and go to localhost:3000 I get this error:
"uninitialized constant ApplicationController"

The Application.rb is where it's supposed to be and has the content as written by Ryan. Any ideas as to what's going on? Any help is welcomed. Thanks everyone.

Avatar

I just wanted to say that the pdf writer is very nice, the only complain I have is that when I tried to create a table with 2000 rows it took more than 15 minutes to render the report, which kind of sucks. Am I doing something wrong?
      _p = PDF::Writer.new(:orientation => :landscape)
      _p.select_font 'Times-Roman'

      PDF::SimpleTable.new do |tab|
        tab.title_font_size = 10
        tab.heading_font_size = 8
        tab.font_size = 8
        tab.width = 700
        tab.orientation = :center
        tab.title = "#{@report.name} as of " + (Time.now()).strftime("%a %b %d, %Y")
        tab.column_order = @results.first.attribute_names
        #Rename Columns
        @results.first.attribute_names.each do |mykey|
          tab.columns[mykey] = PDF::SimpleTable::Column.new(mykey) { |col| col.heading = mykey.slice(6..-1) }
        end
        tab.data = @results
        tab.render_on(_p)
      end
      send_data _p.render, :filename => "#{@report.name}.pdf", :type => "application/pdf"

Thanks for your suggestions

Avatar

I am having some conflicts between jquery and setting defaults in javascript_include_tag. Does anyone know how Tyler converted the railscast prototype javascript to use jquery instead?

Avatar

oh, i just included the current cart as in the new method of the OrderController. silly me...

Avatar

second thoughts...

if i'm understanding this correctly, i can get all the order details (and items) thru the returned express_token. (since i'm actually sending PaymentDetailItems in my purchase).

question: can i access the token details directly on my orders new ERB? or is there a better way to do this?

Avatar

great screencast, got me most of the way. i still have questions about integrating a list of ordered products on the confirmation page (after going to paypal).

i can't seem to get the cart line items to list on the confirm page. (this is the Orders -> new.html.erb page).

specifically i thought i would be able to access the cart thru @orders.cart.line_items, but i'm obviously missing something. in fact the @orders.cart_id seems nil.

does this get lost in the Express situation?

Avatar

@Piotr Nowak: AFAIK there is no such thing as cron in Windows, so nope - it works only on various Unixes: Linux, *BSD and so on...

Avatar

Also having another issue where the remove links don't work on IE7 or IE8. Does anyone know why? It almost seems that the javascript_include_tag :defaults isn't being used since it has the same behavior when javascript_include_tag isn't in your application.rhtml file.

Avatar

Got it! Part three fixed everything for me beautifully.

Avatar

Use http to see Tyler's code.

http://gone-cat-open-source-software.googlecode.com/svn/tags/herbs-test-railscast-75

Avatar

Thanks Ryan for this wonderful Screencast!
Please u can make a screencast with Authlogic + Role based Authorization !
Great Job!!!

Avatar

The big problem with the cron/rake pattern is that it loads the environment every time it needs to run a task.

The scheduler_daemon plugin is a much cleaner solution.

Check it out: http://github.com/ssoroka/scheduler_daemon

Avatar

Ryan, to get this magic to work could I use jquery instead of :defaults? The reason I ask is we are already using jquery and when I add :defaults in some other javascript on the same page stops working since it requires jquery.

Avatar

ryan, you have been so helpful to me.

Question: I am directing to the URL (not content) but can't figure out how get a sidebar on sub-pages since I have redirected to a new page. Any help would be greatly appreciated.

Many thanks.

Avatar

Giving some love to craken as well:
http://github.com/latimes/craken/tree/master

Avatar

If it helps, the relevant portions of my application are at http://pastie.org/498539.

It works for creating a new model, but has trouble updating an existing one.

It seems to be trying to pull the id of my submodel...

(Thanks in advance!)

Avatar

Wonderful screencast! Exactly what I want -- except I'm having trouble getting it to work!!

It tells me "undefined method `stringify_keys!" -- any idea what might be going on?