Allowing pass couple extension to one register_template_handler call #7644

Merged
merged 1 commit into from Sep 17, 2012

5 participants

@timsly

To make possible add synonyms extension by one function call

ActionView::Template.register_template_handler :md, :markdown, markdown_handler
@rafaelfranca rafaelfranca and 1 other commented on an outdated diff Sep 14, 2012
actionpack/test/template/render_test.rb
@@ -451,6 +451,20 @@ def test_render_layout_with_object
assert_equal %(<title>David</title>),
@view.render(:file => "test/layout_render_object")
end
+
+ def test_render_with_passing_couple_extensions_to_one_register_template_handler_function_call
+ ActionView::Template.register_template_handler :foo1, :foo2, CustomHandler
+ assert_equal @view.render(:inline => "Hello, World!", :type => :foo1), @view.render(:inline => "Hello, World!", :type => :foo2)
+ end
+
+ def test_render_with_passing_couple_extensions_as_array_to_one_register_template_handler_function_call
@rafaelfranca
Ruby on Rails member

I would not make possible this case. This would avoid the flatten call.

@timsly
timsly added a note Sep 15, 2012

I just try to make it as much flexible
But i think you are right, i will remove that case to make it work faster

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@rafaelfranca
Ruby on Rails member

We need a changelog entry and docs updated.

@rafaelfranca
Ruby on Rails member

@josevalim could you review this one to see if make sense add it?

@carlosantoniodasilva
Ruby on Rails member

Perhaps we could have a register_template_handlers method instead? Not sure.

@timsly

Not agree, because we register only one handler but associate it with couple extension

@guilleiguaran
Ruby on Rails member

@carlosantoniodasilva please no, we will be breaking a lot of gems without much benefit

@rafaelfranca
Ruby on Rails member

@guilleiguaran I don't think adding a new methods would break, but I agree that it is not necessary.

@guilleiguaran
Ruby on Rails member

@rafaelfranca ok, I was thinking in renaming of the current existing method to register_template_handlers, I agree also, I think we don't need it really

@carlosantoniodasilva
Ruby on Rails member

It was not about renaming, but allowing extra arguments. Anyway, both would work, no no need for new methods at the end.

@rafaelfranca
Ruby on Rails member

@insside could you squash your commits?

@timsly

@rafaelfranca, i have squashed my commits

@steveklabnik
Ruby on Rails member

It still says they can't be merged, I think you need to rebase as well.

@timsly

Is it possible merge now, or i need run to rebase one more time?

@rafaelfranca
Ruby on Rails member

We need another rebase.

@timsly

@rafaelfranca, i did rebase. Please check

@steveklabnik
Ruby on Rails member

It can merge cleanly right now. Let's hope @rafaelfranca gets to it quickly! :p

@rafaelfranca rafaelfranca merged commit d9f936e into rails:master Sep 17, 2012
@rafaelfranca
Ruby on Rails member

I'm here.

Thanks.

@steveklabnik
Ruby on Rails member

❤️ ❤️ ❤️

@timsly

wooohoooo!!!!! My first commit, thank you guys )))

@steveklabnik
Ruby on Rails member

http://contributors.rubyonrails.org/contributors/tima-maslyuchenko/commits ;) keep submitting pulls and hitting f5! It's what I do.

@rafaelfranca
Ruby on Rails member

Welcome to the Rails contributors

@timsly

:-)
thanks for the tip
Doing this right now)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment