RailsCasts Pro episodes are now free!

Learn more or hide this

Recent Comments

Avatar

I believe putting the rsync task in there will run it on the server machine, where you probably want to run that on your local machine to rsync files from the local machine to the server.

 Is there a way to run commands/tasks for deployment on the local machine?

Avatar

>>>p.save Don't work<<<

p =Product.find(:last}) # GET products.xml?search=table

p.name = 'bar'
p.save # PUT products/11.xml
# => false
Don't change the name!!!

on the server side throws this msg:
WARNING: Can't mass-assign these protected attributes: id

Did it actually work for you ?

Avatar

Thijs de Vries,

Thanks for the tip. However, I've switched to vim since I posted my question about syntax highlighting. I've been searching for an easy way to tell vim to consider a pdf.prawn file as ruby code, but I can't seem to find anything. Any help is appreciated :)

Avatar

waqas, wasnt that kind of the point? if you want to change the names individually you can do that easily with the regular form.

Avatar

Ryan,

you might want to use singular resources for manipulating current_user, so that you don't have to pass in :current and such to edit_user_path. Perhaps you're aware of this and didn't want to mention too many different things in the screencast, but I thought it was worth mentioning anyways.

Avatar

As a follow up -- Sauce Labs has cloud-hosted Selenium, and provides a drop-in Selenium RC replacement that can be called from Ruby scripts. You can learn more at http://saucelabs.com/ .

Avatar

I'm new to cucumber and I'm trying to understand some best practices.
For instance after executing an action should I use something like
"then I should be redirect to home_page" or should I concentrate my attention to the page content, such as "then I should see 'welcome to the home page'"?

Thanks
 

Avatar

@Jake -- Marty Andrews and I made a spike of crap4r at http://github.com/kevinrutherford/crap4r/tree. Nothing wonderful yet, mostly due to lack of time and the difficulty of digging information out of rcov.

Avatar

Just for the record, 'Saikuro' would be pronounce roughly like 'sigh-crow', which is a Japanese approximation to 'cyclo.'

Avatar

Anyone know if there is a way to send build options to 'rake gems:build'? I need to set the '--with-mysql-dir=/usr/local/mysql' for the mysql gem.

Avatar

Ryan, you made a comment in the podcast about not liking the look of the output from RCov. I agree, to the point that a month or so ago I created a fork that generates better-formatted output, sortable columns, and even lets you use your own external CSS style sheet.

More information is at http://www.idolhands.com/ruby-on-rails/making-rcov-pretty-with-custom-css/ and the project itself can be downloaded from http://github.com/Bantik/rcov

Avatar

Hey, Ryan, thanks for being my 2nd tutor in Rails :)

When changing password to crypted_password we're breaking the test's fixtures, so make sure to check those!

Avatar

Every cast is really fantastic, thanks Ryan, i'm going to learn more about this. I don't knew nothing about Metric Fu. I like simple things.

Avatar

Hello Ryan,
great screencast as always.
I'm trying to update the user factory you have created on this episode in order to handle password_hash and password_salt (when the user inputs his/her password).

Any ideas about how to deal with this issue?

Thanks and have a good 1!

Avatar

When shall we expect to see some new mastering-rails-forms screencasts?

Thank you,
Jason

Avatar

@gUI, I wish I could have had time to go into more detail but I had to do this episode at the last minute. My scheduled episode covered a new feature in 2.3.3 which I expected to be released by now, but it has been delayed.

@Erik, thanks for the link. I'll add it to the show notes.

Avatar

There is a neat fork done by a ThoughtBot guy at http://github.com/qrush/metric_fu/tree/master that gives the metric browsing site some nicer styles to match the Integrity CI server styles.

Avatar

Hi gUI. In defense of Ryan, if you want a more detailed screencast, pls feel free to start your own.

ryan's given us 166 great screencasts. if it weren't for these, my RoR understanding wouldn't be what it is.

it's good that they're short because it makes you explore the API more on your own time, not Ryan's time.

Avatar

Nice subject, but this screencast is really to short !!!

Don't hesitate to give us more details on each of these tools.

Avatar

I'll be doing metric_fu.

Avatar

What I mean by the above is you can put a login or email address in to one field along with your password in a different field.

Avatar

Can you login with either a username or password?

Avatar

Hi Ryanb,

First of all another useful screen cast. Would be nice if some AJAX is thrown in there, but looks good as it is. Another thing Ryan, if you wanted to change the name of 3 selected products, hows that done as the form only has one text_field for name and i believe if you enter some name in the text_field that will apply to all three??? can you please shed some light on that?

Avatar

Hi Ryan,
Thanks for the great complex form railscasts! Do you have plan to update them for 2.3 with Nested Model Forms?

Avatar

I finally got it resolved, the plugin installed from the git was "available" in the svn directory but I had to also run script/plugin install acts_as_tree to install it in the apps vendor directory

Avatar

I was really excited about learning Ruby and Rails, but it seems EVERY little thing is like banging my head against a wall...
I followed everything and still cannot get this to work. I keep getting "undefined local variable or method `acts_as_tree'"

I installed the plugin per your instructions and script/plugin list includes the acts_as tree plugin

I added acts_as_tree to class Page < ActiveRecord::Base (It's one line how hard can it be!!!)

And I restarted the server (many, many times!!!) I still get undefined local variable or method `acts_as_tree'

If there are additional steps for plugins to be seen I can't find them, and I have googled half a day away!

Avatar

Ryan I have a problem but it's not with this episode I have wall on my page like this but long single string become a problem in view how can I prevent this for example.

:(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((

Avatar

Ryan how can stop this
THISSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS

Avatar

Great! This is the kind of gem i was looking for 2-3 months ago. With this gem I can now configure crontab using capistrano script. Thanks!

Avatar

Has anyone been able to work out the issue with the error -

"You have a nil object when you didn't expect it!
The error occurred while evaluating nil.comments" ?

I am getting the error in my code and the example code on railscast github.

Would love to work out a solution but have not been able to myself.

Avatar

Good work! I will use it in my project.

Avatar

Is it possible to have webrat check for things in the popup after you click on a link?

Avatar

I really liked this railscast. One thing that's left to wonder about is regarding the syntax to instruct rails to render a different javascript file in the respond_to block. I understand the Rails way is to render a file with the same name as the method you're in, but what if I wanted to render a javascript file in a different views folder than that controller with a different filename than that of the method executing the respond_to block?

Avatar

Instead of using @template.link_to() in your controller, you can use self.class.helpers.link_to() which is probably a bit safer than accessing the private API.

Avatar

Hi,
i'm new, how can i see generated queries like you do in the bottom terminal ?

Avatar

This is great! Exactly the use case I was battling with. You saved my day definitely.

Avatar

My application has blog section, where the updates will be happen often (lets assume 5 min once).people always comment for the blog. so if i delete the cached page every time while the comment has entered, what is the point of doing caching in this case. is there any other technique available to overcome this?

Avatar

Hi, I am new to RoR and I am very close to getting this to work, but I am possibly missing something that you covered outside of the screencast. I can view to the selected checkboxes (they are selected appropriately) but I cannot update them (in any case).

Could you please post this railscast's code on your GIT repo? I only saw code for the later episodes.

Avatar

@davide: I thought button_to created another form, and HTML doesn't allow one form inside another one. Nor the "button" tag allow you to specify a different action.

Avatar

@Javier: i'm not sure im really getting what you mean.. you could make an edit-form, with an additional button_to to your delete action?

Avatar

Oops! Sorry, bad example, and it's already covered in episode 138.

I was referring to a form with two completely different actions and even diferent methods (such as edit and delete).

Avatar

Nice screencast! Thanks!

Another interesting one would be adding another button to the form to delete the selected records. Since you can't define a form to have two different actions, I've always wondered if that can be done in a RESTful way. Do you just do two different things in the same action?

I guess you already do that with your preview/submit buttons to add a comment ;-).

Avatar

Thanks Ryan, I love your screencasts!

Avatar

@Lars

Try this to completely replace the code given for products/_form.rhtml

<%= select_tag "product[category_ids][]", options_from_collection_for_select(Category.find(:all), "id", "name"), :multiple => true %>

I haven't however worked out how to show items as already selected based on the categories already associated witht the product.

Avatar

Your lessons are wonderful!!

If I can make a suggest: Wouldn't be better if you make railscasts wide enough to see the code without scrolling? If not the default choice, at least a link to see it at 1024px wide... a lot better than changing it with firebug!!

Thank you

Avatar

Found the problem. Ryan, you're the man!!!