Rails designates one helper module per controller, but that shouldn't stop you from making custom helper modules to help structure the code. Learn how in this episode.
I really enjoyed this and am already refactoring 2 of my apps. Sweet!!
@ Drew
If you watch this one you will see that it's just simple organization of code.
@Stijn
I totally agree.. One railscast per week is totally unacceptable for my raging habit. I may need to join a support group or 12-step program for getting off Ryan's Rails-Crack
Even as I know that this is a hard work to create and produce such great screen casts every week, I will be sad if I have to wait whole week for a new pearl of wisdom.
Please reconsider you intention and make us all happy and better developers.
Thank you for all the great railscasts Ryan. They have truly improved my coding! Following up on some of the previous comments, I think a section of the site for suggested topics would be useful for ideas. Also maybe instead of 1 railscast for "free" each week perhaps you can do 2 per week but the 2nd one is only available to donating members and is unlocked the following week for non-donating members to view. You do excellent work and I think it's only fair you should be compensated in return for it.
Thanks Ryan for all your hard work.
Although I could happily view a new Railscast every day, this will give me a chance to go over the older ones again.
You've created a great collection to supplement the Peepcode shows.
One Railscast a week is a bit sad, but I can live with it.
Maybe if we start donating we'll help Ryan with his great work.
I also like Michael's ideea.
Every Monday, Wednesday, and Friday I made it a ritual to get up first thing in the morning, load Google Reader, and excite myself seeing 'Railscasts (1)'. Unfortunately, that ritual can only happen on Monday now. With this happening, and the fact that Mr. Peepcode is releasing screencasts in shorter "parts" now to get more money, I can't help but feel the Rails community is dying. Please resurrect it. You are our savior.
Don't worry, Railscasts isn't going anywhere. I may still do three a week once and a while when I have the time, just don't count on it being a regular occurrence. This will give me some more time to catch up on the other things I've been putting off.
I would suggest Ryan do one per week but make them much longer.
And/Or, do a 1-2 HOUR screen cast on a really detailed subject and sell them. But that would compete with Peepcode. Maybe he could sell them through Peepcode.
cbmeeks
http://www.signaldev.com
I just got into railscasts, so this move to 1 a week is even more shocking to me. Until recently, I was able to watch one new 'cast a day, but now that I'm caught up, one a week seems like an even bigger shock to most. Anyway, great work! I look forward to future "lessons" no matter how infrequent.
I completely understand only doing 1 per week -- personally, I would like 10 per week! You're doing a great job...
As a future screencast request, maybe sometime you could explain method_missing and show one or two clever ways it can be used? Just a thought... Keep up the good work!
I am in agreement with others that one a week won't satisfy my need for your railscasts but can appreciate the time needed to make and edit them, perhaps now that your only doing one a week they can be a little longer? Anyway, thanks for the great content you have already provided
I had to laugh at the comments about one a week. I discovered railscasts this morning and I've just watched all 64! It's been a fantastic way to spend a rainy Saturday. Keep up the good work!
I've always thought the frequency and quality of the content was fantastic. I really appreciate all the work you've put into Railscasts, an excellent resource.
Steering things back on topic, I ran into an issue refactoring some helpers. Apparently any helper with the url_for method doesnt work anywhere else but the application_helper file.
I tried many different ways but Rails seems pretty unbending in this aspect.
Hallison,
I am having the same experience of the missing all_helper.rb with a reinstall on a shared server. If you find out the cause of your error would you be kind enough to post it here? The host has not been able to help and I am going nuts.
My rails version is 1.2.3
Thank you
That seems pretty well organized. But then, if you have a dozen helper files and access them from a dozen different views, then if you are looking in the view and you see a call to a method, you really have no idea where it is defined, and most people use their IDE to find it. And what happens if you use the same name for a method in each of 2 different helper modules?
And these helper methods are for views, anyway, not for controllers, so I don't think it is very nice to have to include them in the controller. I think it would be much better if we were including them in the views, or perhaps just calling them with their module name and method name.
Is anyone else underwhelmed by the way the helpers work?
Hey, where's the code snippet on this one?
You have us spoiled with those!
I know, I need it!
Only 1 a week? My weeks will be much more boring :-)
Many thanks for all the great screencasts.
I really enjoyed this and am already refactoring 2 of my apps. Sweet!!
@ Drew
If you watch this one you will see that it's just simple organization of code.
@Stijn
I totally agree.. One railscast per week is totally unacceptable for my raging habit. I may need to join a support group or 12-step program for getting off Ryan's Rails-Crack
Hey.
Good cast. Haven't tried this approach, but I will :).
One railscast per week.. that's sad news. Atleast it's something, and now Ryan has time to put up maybe even something more complicated cast.
Even as I know that this is a hard work to create and produce such great screen casts every week, I will be sad if I have to wait whole week for a new pearl of wisdom.
Please reconsider you intention and make us all happy and better developers.
Hi Ryan
these are great, you should start charging :)
Hey Ryan, Once a week is fine by me ;-) I'm getting information overload here!!
He's gotta be running out of screencast ideas. We'll all need to email him a new idea for railscasts. All at once.
One a week is sad, but it is definitely a lot to sink my teeth into as it is... keep up the good work Ryan!
Thank you for all the great railscasts Ryan. They have truly improved my coding! Following up on some of the previous comments, I think a section of the site for suggested topics would be useful for ideas. Also maybe instead of 1 railscast for "free" each week perhaps you can do 2 per week but the 2nd one is only available to donating members and is unlocked the following week for non-donating members to view. You do excellent work and I think it's only fair you should be compensated in return for it.
Aw, only one a week :-(
I can't knock you for wanting a break but I've had no problem at all digesting them at the rate you're pumping them out :-)
Thanks for all the hard work.
Thanks Ryan for all your hard work.
Although I could happily view a new Railscast every day, this will give me a chance to go over the older ones again.
You've created a great collection to supplement the Peepcode shows.
Thanks for your effort.
These casts are truely fantastic.
One Railscast a week is a bit sad, but I can live with it.
Maybe if we start donating we'll help Ryan with his great work.
I also like Michael's ideea.
Every Monday, Wednesday, and Friday I made it a ritual to get up first thing in the morning, load Google Reader, and excite myself seeing 'Railscasts (1)'. Unfortunately, that ritual can only happen on Monday now. With this happening, and the fact that Mr. Peepcode is releasing screencasts in shorter "parts" now to get more money, I can't help but feel the Rails community is dying. Please resurrect it. You are our savior.
I really enjoy watching the RailsCasts. They teach me -a RoR-beginner- a lot. Keep up the good work, even it's "only" once a week.
Don't worry, Railscasts isn't going anywhere. I may still do three a week once and a while when I have the time, just don't count on it being a regular occurrence. This will give me some more time to catch up on the other things I've been putting off.
Great screen cast.
I would suggest Ryan do one per week but make them much longer.
And/Or, do a 1-2 HOUR screen cast on a really detailed subject and sell them. But that would compete with Peepcode. Maybe he could sell them through Peepcode.
cbmeeks
http://www.signaldev.com
I just got into railscasts, so this move to 1 a week is even more shocking to me. Until recently, I was able to watch one new 'cast a day, but now that I'm caught up, one a week seems like an even bigger shock to most. Anyway, great work! I look forward to future "lessons" no matter how infrequent.
I completely understand only doing 1 per week -- personally, I would like 10 per week! You're doing a great job...
As a future screencast request, maybe sometime you could explain method_missing and show one or two clever ways it can be used? Just a thought... Keep up the good work!
I am in agreement with others that one a week won't satisfy my need for your railscasts but can appreciate the time needed to make and edit them, perhaps now that your only doing one a week they can be a little longer? Anyway, thanks for the great content you have already provided
I had to laugh at the comments about one a week. I discovered railscasts this morning and I've just watched all 64! It's been a fantastic way to spend a rainy Saturday. Keep up the good work!
I've always thought the frequency and quality of the content was fantastic. I really appreciate all the work you've put into Railscasts, an excellent resource.
Steering things back on topic, I ran into an issue refactoring some helpers. Apparently any helper with the url_for method doesnt work anywhere else but the application_helper file.
I tried many different ways but Rails seems pretty unbending in this aspect.
Hi Ryan.
I use your tip, but my server thow an exception: (part of message)
Missing helper file helpers/all_helper.rb
./script/../config/../vendor/rails/actionpack/lib/action_controller/helpers.rb:71:in `helper'
./script/../config/../vendor/rails/actionpack/lib/action_controller/helpers.rb:58:in `each'
./script/../config/../vendor/rails/actionpack/lib/action_controller/helpers.rb:58:in `helper'
./script/../config/../app/controllers/application.rb:7
./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:204:in `load_without_new_constant_marking'
./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:204:in `load_file'
./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:343:in `new_constants_in'
./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:203:in `load_file'
./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:95:in `require_or_load'
./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:61:in `depend_on'
./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:443:in `require_dependency'
./script/../config/../vendor/rails/railties/lib/dispatcher.rb:110:in `prepare_application'
./script/../config/../vendor/rails/railties/lib/dispatcher.rb:39:in `dispatch'
./script/../config/../vendor/rails/railties/lib/webrick_server.rb:113:in `handle_dispatch'
./script/../config/../vendor/rails/railties/lib/webrick_server.rb:79:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
./script/../config/../vendor/rails/railties/lib/webrick_server.rb:63:in `dispatch'
./script/../config/../vendor/rails/railties/lib/commands/servers/webrick.rb:59
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:496:in `require'
./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:343:in `new_constants_in'
./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:496:in `require'
./script/../config/../vendor/rails/railties/lib/commands/server.rb:39
./script/server:5:in `require'
./script/server:5
Missing helper file helpers/all_helper.rb
./script/../config/../vendor/rails/actionpack/lib/action_controller/helpers.rb:71:in `helper'
./script/../config/../vendor/rails/actionpack/lib/action_controller/helpers.rb:58:in `each'
./script/../config/../vendor/rails/actionpack/lib/action_controller/helpers.rb:58:in `helper'
./script/../config/../app/controllers/application.rb:7
My helpers:
- html_content_helper
- opcoes_controle_helper
- paginacao_helper
Do you help me?
PS: My Rails version is 1.2.6
Hallison,
I am having the same experience of the missing all_helper.rb with a reinstall on a shared server. If you find out the cause of your error would you be kind enough to post it here? The host has not been able to help and I am going nuts.
My rails version is 1.2.3
Thank you
Ruby and Hallison: You need to use rails edge (or 2.0) for that. Pay attention, Ryan says that in the cast!
That seems pretty well organized. But then, if you have a dozen helper files and access them from a dozen different views, then if you are looking in the view and you see a call to a method, you really have no idea where it is defined, and most people use their IDE to find it. And what happens if you use the same name for a method in each of 2 different helper modules?
And these helper methods are for views, anyway, not for controllers, so I don't think it is very nice to have to include them in the controller. I think it would be much better if we were including them in the views, or perhaps just calling them with their module name and method name.
Is anyone else underwhelmed by the way the helpers work?
This episode has been updated to Rails 5 as a blog post Custom View Helpers in Rails 5