RailsCasts Pro episodes are now free!

Learn more or hide this

Recent Comments

Avatar

I'm still not able to get this to work in 2.2.2. I have added the following to my router per #78
map.js ':controller/:action.:format'

I am using this with a partial and so am not sure if this is affecting anything.

Could anyon who has got this working in 2.2.2 share the code?

cheers
Michael

Avatar

ryan, absolutely rate your casts. Best thing since cheese on toast.

Ive tried to create an ajax version of this using form_remote_tag but having problems (im fairly new at rails). Im wondering is implementing ajax functionality for this situation any more complicated than usual ajax stuff and hence why you didnt introduce it here?

Could you provide me any hints or warnings regarding this?

Avatar

@Chris Barnes
I got the same error, do you have solved?

Avatar

Absolute wizardry :) Thank you!

Avatar

Ryan, with today's episode, I've just caught up on all the Railscasts -- well, except all the e-commerce ones because I don't do that. Yet.

Congratulations on 150 episodes, and thanks for doing this for two years! You've provided me with a much better insight into the way Rails operates, and I've incorporated at least a dozen tips from your casts into my daily coding.

Avatar

Another Great episode! Keep up the good work.

Avatar

150 amazing screencasts ! A big thanks Ryan !

Avatar

i'm trying to setup a route that's something like

map.connect ":foo/:controller/:action/:id", so i get :foo as a parameter.

that statement doesn't work in my routes.rb, but i'm a little confused about how to do it if it's possible at all (all the examples i've seen are of the form "controller"/"action"/[extra stuff]

any advice/suggestions would be greatly appreciated!

thanks!

Avatar

Great episode! Thank you so much.

Has anybody used this in combination with cucumber and webrat for testing?

I would like to use wabrats fill_in method to fill in two or more tasks of the project (as in Ryan's example). However, as those fields are generated from the same partial they all have the same name and id.
Has anybody found a way to tell webrat to use the second or third field with a certain name/id?

Thanks for your inspirations!
Björn

Avatar

Anyone have any suggestions for key names and organization of translation files?

Avatar

I'm very interested of finding a solution to the problem that Stephen Tudor describes in comment 39

Avatar

Please make sure to read over this post before getting too involved with your metal :)

http://weblog.rubyonrails.org/2008/12/20/performance-of-rails-metal

Avatar

Hi, I just created a patch to run engines migrations with rake tasks, without sync/copy any file.

It adds db:migrate:engines and db:migrate:engines:down to run all the migrations from engines or for reset them.
You can also specify a single engine with the ENGINE env var.

This is the LH ticket: http://tinyurl.com/b2acxp

Avatar

Is there away I can check if sphinx is running, so I can decide of to call the Model.search call in code?
Thanks.

Avatar

Hi Ryan, many thanks for your wonderful screencast !

A simple question: is it possible to use metal for multithread execution or large upload handling ?

Avatar

Hey Ryan,

You are truly the man! Thanks so much for all the work you do. It has really helped me over the past year, and I hope it will continue for years to come!

Avatar

Hi

the view works perfect for me, but the controller method 'update' doesn't. How does that link with the update of the product ?
I get "primary key must be unique" errors on my link table everytime I check boxes and update...

Avatar

Hey Ryan, congratulations on episode 150. I've really appreciated these railscasts every week. Keep up the great work!

Avatar

1. Richard: I believe active merchant already works with authorize.net. The gateway you need to instantiate will need to be different.

2. Did anyone else run into problems with this error on rake gems:install :-

/Library/Ruby/Site/1.8/rubygems.rb:149:in `activate': can't activate
activesupport (>= 1.4.1, runtime), already activated
activesupport-2.1.0 (Gem::Exception)

I searched and searched but found no solution.

Avatar

I've got a strange problem: I followed these steps, and everything works perfectly when I save to the db and pull records out of the db: that nice Pacific Time translation happens automatically.

The problem is that when I use Time.now I get Pacific Time -0800, which is a double offset! It should either be UTC -0800 or simply Pacific Time. Any thoughts?

Avatar

Rails Metal is a thin layer above Rack, just like Sinatra is, and Sinatra is doing this way before Rails Metal appeared ... Rails Metal like Sinatra is a thin DSL above Rack so you don't have to code pure Rack and instead can code a simplified language above Rack. What I don't get, is why someone would use Sinatra app inside a Rails app (see some sample on the web), since you can use Metal or better, pure Rack inside Rails.

Avatar

Haha~, I am refreshing the home page many times today for this episode. Great screencast! Thank you.

Avatar

I was testing a few things out using apache bench after I watched the episode, and perhaps something you should have mentioned was how to kill the detached server process. I never knew how to do this, and I ended up killing ruby and restarting it to kill the server listening on port 3000. If anyone does know how to do this off hand, I would love to know.

Thanks

Avatar

Great screencast... I've heard of metal before but this made me go and try it out. Thanks!

Avatar

Congratulations and a big Thank You! for your 150 railscasts. Great job!

Avatar

Nice tutorial! :) I've been following these for a while.

However, is there any simple way to drag items between lists, or to drop an item into a dropbox?

Avatar

Great screencast Ryan. Very interesting topic, and a very good use case for Metal.

Avatar

Ryan, how Metal is different than Rack? Is Metal just Rails effort to be Rack compatible? Please excuse my ignorance.

Avatar

Again a great episode on performance tuning!

Determining what actions might benefit from metal should be determined by analysis of request times, to avoid the trap of premature optimization. You can use request-log-analyzer (wiki.github.com/wvanbergen/request-log-analyzer) to analyze the request times from your logs. (Full disclosure: I am one of the authors.)

Note that after you have rewritten an action using metal, it will NOT show up in the logs and therefore it will no longer be included in performance reports generated by request-log-analyzer.

Avatar

Thanks Ryan for this screencast and congratulation for #150!

Avatar

Ryan, nice episode, many thanks!

I've added a checkbox to the tasks to mark them if they're done. Unfortunately, every time i mark a task as completed, it will be duplicated and the next task has the same name but becomes completed. If i hit save again, the procedure repeats again.

Any idea where the error could be? The whole code code is 1:1 the same as yours, except my addition

<%= tasks_form.check_box :is_completed, :index => nil %> is completed

Any suggestions would be great, thanks!

Pascal

Avatar

Thanks! I have successfully used the feature (including cache in next episode) for a model.
I have a problem to reuse this js for many models. Because we specify the model name 'person' in RJS like 'person_country_id', the f.select and f.collection_select always automatically set the ID for us. I want to get rid of the "person_" part. But
How to get rid of the "person_" part by manually specify the DOM ID in
f.select or f.collection_select

Hope I make myself understood.

Avatar

The spam is out of control!

Great screencast. Would love to see a screencast on testing. I just cannot get started with it; there are so many variables.

Avatar

Hi Ryan,
I found that if you edit a product that have an image, if you save it without upload a new one, the first image is lost. Is this a bug of paperclip?

Thanks!

Avatar

I whipped up a plugin inspired from the original engines plugin that handles migrations (through rsync, like the screencast) and asset loading (more like the original plugin). Fork away ...

http://github.com/hpoydar/engines-helper

Avatar

This was an great screen cast.

Once I set this up in my rails application with Passenger, it works fine development wise. But when I switch it to production mode, via passenger or running on mongrel, I'm no longer able to login. Any ideas on what would cause this?

Avatar

I had to do PayPal recurring payment before the Railscast becomes available. So I put together an extention and wrote a blog post about it.

http://rayvinly.com/articles/2009/02/20/paypal-recurring-billing-with-activemerchant-in-ruby-on-rails/

I hope it works out you all who need to do similar things. There are stuff you can configure. ActiveMerchant is real nice.

Feedback will be appreciated.

Avatar

Great cast, and an even better update :). Thanks for that!

I'm currently struggeling with the following problem though:
If you delete a task but then have a failing validation on update (e.g. an empty project name) the task is deleted anyways.

Maybe not a big issue but inconsistant with the transaction model ("all-or-nothing").

The reason for this to happen is quite obvious if you watch the logs: the sql-DELETE is encapsulated by an individual BEGIN-COMMIT frame.

Is there any way to avoid that?

Thanks!
Rainer

Avatar

I've came up with a minimalistic plugin, plus lots of README. But it's dangerous so read the info!

http://github.com/TomK32/route-of-destruction

Avatar

As usual, great cast.

One question, is it possible to do something similar with a show form and 2 sub models. i.e show a projext and be able to add tasks as well as entries to a projectlog.

I tried simply adding a form to a show view to create the extra model but seem to have much success

any suggestions would be great

Michael

Avatar

R2D2 is back! ^^

Avatar

Thanks for this excellent and simple way to use presenter objects.

However, in one application I have a problem with the method_missing.
It seems not to work for the select helper method that I call.
(Maybe the select method that I call is already known for the object as another select method). However, it works if I use self.select instead.
Mybe your solution only works for missing methods and that dublicate methods demands the use of self.

Avatar

Ryan, disregard my earlier posting. I found answers to two of my problems (1. reversal of names -- caused by spelling and length issues, correct by adding :join_table => xxx to assignments) and (2. found that rails had added the timestamps to the join table which was causing other problems.)

Thanks, and sorry for adding a non-issue to the discussion.

Avatar

There have been a lot of ecommerce related Railscasts lately, but I think that is because it is a complex topic. I'll throw in a +1 for recurring billing.

Thanks for all of your work. Railscasts are one of the best resources for the community and they are free. Thanks again.

Avatar

Hey i would like to know if someone has approach I18n for the active merchant plugin
because i'm trying to do it but i can't make it work properly. I
receive the errors messages only in english, i can't get'em translated.
Thanks in advance!

Avatar

Hi Ryan,

I'm pretty new to Rails at this point, and your screencasts have been an amazing resource, so first and foremost - Thank you!

I was able to get image uploads working, but my question is this: at some point in the life of my application, what is going to happen if (obviously a big "if," but it's what I'm hoping for) I am hosting enough files that I reach the 32,000 sub-directory limit? Is there a simple solution to this problem (if it is in fact a problem)?

Thanks so much!

Avatar

When using Rails 2.3 it seems like the respond_to format.js is rendered with the application layout. Anyone that know why?

Avatar

Excellent presentation as always. However, this "feature" seems pretty lackluster. It would be much cooler, and a lot more useful if there were items like "script/export engine" and "script/import engine". Or, perhaps even support "script/import engine --from existing_project". The inherent ability is very cool, but the mechanism by which to achieve the desired result -- eh...

Anyway, a continuous "thanks!" for spending so much time with this screencast. Keep up the amazing work!

Avatar

have you tired this with authorize.net? I'm trying to customize it to make it work with the authorize.net. Ideas?

Avatar

A plugin-based Rails generator would be a great way to create migrations and synchronize public assets for an engine.

Rails will handle file naming and conflicts automatically. And a simple file copying or migration generator is quite easy to write.

http://api.rubyonrails.org/classes/Rails/Generator/Base.html