On Wednesday, February 5, 2014 7:29:41 PM UTC, Ruby-Forum.com User wrote:
>
> Frederick, 
>
> Thanks. I am glad you agree with me. By the way, do you recommend 
> setting this option to false as good practice on every fresh project? 
> Looks like your idea solves the issue, but of course, will force you to 
> dump stuff like you said, in application.rb. 
>
>  
I always do. It doesn't force you to dump stuff in application_helper.rb, 
it just makes that the path of least resistance.
 

> I researched a little bit and I found a way to reference common code in 
> application without bloating it out making you suggestion a good 
> practice. 
>
> For instance, instead of placing Currency code in application code you 
> just reference it with an include and it will be available in all views. 
> This is better approach than the promiscuous helper architecture 
>
> module ApplicationHelper 
>   include CurrencyModule 
>
> def blabla 
> end 
>
>
Personally I'd rather write 

helper :currency

in application controller (or whatever is the appropriate subset of 
controllers). 

Fred
 

> Is there any other reason for not doing this: 
> config.action_controller.include_all_helpers = 
> false? 
>
> end 
>
> thanks 
>
> Frederick Cheung wrote in post #1135687: 
> > On Wednesday, February 5, 2014 4:46:12 PM UTC, Ruby-Forum.com User 
> > wrote: 
> >> Does anyone had any problems with this approach? 
> >> Is there another recommended way to work? 
> >> 
> >> 
> >> 
> > 
>
> http://strugglingwithruby.blogspot.com.br/2008/10/view-part-2-scope-helpers-and-partials.html
>  
> >> 
> >> 
> > The reason is to encourage people to split out their helpers rather than 
> > just dumping everything in application_helper.rb (because with this you 
> > can 
> > do that without having to add lots of helper :blah lines to your 
> > controllers). Personally I think it's a really bad idea for the reason 
> > you 
> > mention and always set config.action_controller.include_all_helpers = 
> > false 
> > to stop this happening 
> > 
> > It's also worth looking at gems just as draper - a lot of the helpers I 
> > used to write secretly wanted to be decorators 
> > 
> > Fred 
>
> -- 
> Posted via http://www.ruby-forum.com/. 
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/963c255a-36d3-452b-b686-cc45fe9ea945%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to