I want to set aside the arguments on whether this would encourage less
clean code or move Rails in good direction.
I can imagine scenarios where this would be useful in hectic, real-world
development. However, that should not be the standard for including
functionality in Rails. I imagine the Rail
This is actually my point. Helpers are useful when you build a method that
is reusable enough to be used in different places. I didn't write this
because I wanted to get rid of helpers. I still use helpers while using
this new content_tag() method.
My rule of thumbs is as follow:
I start with
Could you give an example how to test it before burying my argument.
Also helpers can be reused in other views/partials .
On 27 October 2014 15:19, Pier-Olivier Thibault wrote:
> This is as testable as any helpers. This argument is moot.
>
> On Monday, October 27, 2014 9:58:42 AM UTC-4, Abdelkad
This is as testable as any helpers. This argument is moot.
On Monday, October 27, 2014 9:58:42 AM UTC-4, Abdelkader Boudih wrote:
>
> Helpers are testable!
> Views should have no complex logic on them.
>
> On 27 October 2014 11:40, Pier-Olivier Thibault > wrote:
>
>> I am aware of the existence
Helpers are testable!
Views should have no complex logic on them.
On 27 October 2014 11:40, Pier-Olivier Thibault wrote:
> I am aware of the existence of helpers. But they are in no way a silver
> bullet to building HTML tags. First of all, the number of helper_class()
> methods proportionally i
Le 26 oct. 2014 à 18:34, Pier-Olivier Thibault a écrit :
> With builtin' methods, there's many way to build this kind of HTML tag. And
> I'm sure people here knows a few of them. However, none seem to really make
> it easy to build them. So I decided to take a stab at it this weekend and
> ca
I am aware of the existence of helpers. But they are in no way a silver
bullet to building HTML tags. First of all, the number of helper_class()
methods proportionally increment with the number of attributes/class you
use. Soon enough, you get very complicated helper method name due to very
clo
:-1: You should be using helpers.
<% for @posts.each do |post|%>
<%= content_tag :li, post.title, class: post_classes(post) %>
<% end %>
# in PostHelper
def post_classes(post)
# your code here
end
On 27 October 2014 09:02, Anuj Dutta wrote:
> Hello,
>
> How about moving the conditional to
Hello,
How about moving the conditional to a helper in your first example? Just
curious to know if you would prefer that approach.
Thanks.
Anuj
On 26 Oct 2014 17:34, "Pier-Olivier Thibault" wrote:
>
> Hello everyone,
>
> I have a feature request here that comes from an internal struggle here
b