This is awesome, I'd like to se this combined with Formtastic, thanks for the awesome screencast!
i love formtastic. would be great if it is standard like ryans nifty generators.
Thanks for this screencast Ryan. This definitely enhances the functionality of episode #165. These casts on dealing with multiple edits, models, nested_attributes etc are extremely helpful for my self.newbie to wrap my head around these things.
Much appreciated,
Branden
This is xcellent screencast. Keep up the good work Ryan. I will be using this in my upcomgin RoR project.
Interesting as always..
Didn't know about the ClassName.update method.. been writing some excessive work-arounds to match this exact functionality (with validations).
+1 for combination with Formtastic.
Thanks for your work!
I love how you make the techniques in each screencast seem so simple, as in, "Why didn't I think of that!".
I think it inspires new guys like myself to sit back and look for a simple solution instead of over thinking a problem, which I tend to do all the time.
More times than not the solution is simple; it just takes a better understanding of the wonder that is rails!
Thanks for your work Ryan. I greatly appreciate it.
great episode, as usual :)
+1 for combination with Formtastic.
That's a great episode. Thanks a lot Ryan. It's very useful and perfect to put on practice on every rails project or any project. I like Ruby more. Simple and elegant. Thanks again Ryan.
You said the route would best be a GET and I agree; why not add :method => :get on the form to make it so?
Ryan,
Love the screenscasts! Can I recommend you do one on an administrative tool like Typus (http://intraducibles.com/projects/typus) or something similar. I have used Typus for the first time recently and found it extremely helpful in getting up and running quickly. It does require some configuration of YAML files but you also have the ability to override pretty much everything.
Keep up the good work! Thanks.
Awesome as ever. Perhaps someone would be kind enough to document f.error_messages in the API docs?
I watched it yesterday and was thinking it's trival, useless and will never use it. Or not soon.
And now it looks like it's perfect solution for my today's problem at work. Man, how do you do it?
I cannot understand why you wouldn't do a GET request instead. I mean, sure it will be a long query-string but that also means you could bookmark edit pages. If you keep track of certain products and update them daily that would be excellent.
Or is it really necessary with POST like you said?
Would be interesting to combine webforms2 with this. Following example is screaming at this screencast :)
http://webforms2.googlecode.com/svn/trunk/testsuite/003.html
Hmm, this line in the controller feels a little risky:
Product.update(params[:products].keys, params[:products].values)
"params" is a Hash (actually a subclass of Hash, HashWithIndifferentAccess), and its "keys" and "values" methods return arrays in no particular order. It's probably not a good idea to assume they'll pair up properly every time. Even if it works in practice, it probably exploits an undocumented fact about the Hash implementation.
Something like the following might be more bulletproof. It removes the assumptions but does basically the same thing:
keys = params[:products].keys
values = keys.map {|k| params[:products][k]}
Aside from that, thanks for all the helpful 'casts.
I watched it yesterday and was thinking it's trival, useless and will never use it. Or not soon.
very nice one, thanks!
+1 for combination with formtastic
+1 for usually using formtastic in railscasts ;-)
Ryan,
I haven't tried this yet, but is this the solution to completing the "survey series" (#196, #197) ?
Or do you have something else ?
If so, I'd love to see a final episode to complete the survey app, i.e. where a user can answer the questions on the survey.
Mike
Ryan,
If you click 'Edit Checked' without anything checked you get a walkback:
Couldn't find Product without an ID
How do you trap that error / post an error message?
Mike
Ryan,
I tried the following code, the flash gets displayed, but the 'Product.find' is still getting executed resulting in the error :
"Couldn't find Product without an ID"
begin
rescue params[:product_ids].empty?
logger.error("No products selected for 'Edit Selected'" )
flash[:notice] = "Nothing selected for 'Edit Selected' action"
redirect_to products_path
end
@products = Product.find(params[:product_ids])
Ryan - Great Cast once again!
A Question: How would you implement a "mass edit" facility?
What I mean to say is: say you had an attribute which you want to set to the same thing for ALL rows selected on the front form. How do you do this with a single control?
Cheers
Coach are being sold at low prices. you will get cheap coach handbags, try to keep one coach bag !
http://bagworlds.com/
In reply to myself, I checked out Episode 165
Result!
Another question:
How do you implement a check box that checks all the check boxes (if you know what I mean!)?
Cheers







