From fece5aff93a3dbb20c4b08b8f7dc1c189ed0ad7a Mon Sep 17 00:00:00 2001 From: Christian Beier Date: Thu, 7 Apr 2011 09:58:22 +0200 Subject: [PATCH] fix conflict with I18n.t - Alias t -> st --- README.markdown | 6 ++---- lib/headliner.rb | 4 ++-- spec/headliner_spec.rb | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/README.markdown b/README.markdown index 7ed8d51..e1587fa 100644 --- a/README.markdown +++ b/README.markdown @@ -93,14 +93,12 @@ What if your view headline is different from your page title? <%= title "My page title", "My headline" %> -Mr. T says, ‘Use my method, fool!’ +Mr. ST says, ‘Use my method, fool!’ ================================== Just like ERB's HTML safe method, you can invoke Headliner with a single letter alias. -

<%=t "My page title" %>

- -Note: this alias conflicts with the Rails Internationalization (I18n) API translation method (since it provides the same alias). If you're app requires I18n support, you should use one of [these](http://github.com/nivanson/headliner) [forks](http://github.com/galfert/headliner) on Github. +

<%=st "My page title" %>

How does it work? diff --git a/lib/headliner.rb b/lib/headliner.rb index 43deb10..77881b8 100644 --- a/lib/headliner.rb +++ b/lib/headliner.rb @@ -64,7 +64,7 @@ def display_title(options) content_tag :title, options[:site] end - # Mr. T says, "Use my method, fool!" - alias t title + # Mr. ST says, "Use my method, fool!" + alias st title end \ No newline at end of file diff --git a/spec/headliner_spec.rb b/spec/headliner_spec.rb index 1c360b4..3c70a83 100644 --- a/spec/headliner_spec.rb +++ b/spec/headliner_spec.rb @@ -17,7 +17,7 @@ end it "should respond to 'title' helper alias" do - @view.should respond_to(:t) + @view.should respond_to(:st) end end