From e87d797cdbfe5ebe8dff789742adb6a82d92aae4 Mon Sep 17 00:00:00 2001 From: luca-marie Date: Fri, 26 Aug 2016 17:16:35 +0200 Subject: Small updates on method to check if twitter feed enabled --- app/helpers/twitter_helper.rb | 5 +++-- app/views/twitter/_index.html.erb | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/helpers/twitter_helper.rb b/app/helpers/twitter_helper.rb index 9fd4ffd..b01293f 100644 --- a/app/helpers/twitter_helper.rb +++ b/app/helpers/twitter_helper.rb @@ -1,4 +1,7 @@ module TwitterHelper + def twitter_enabled + Rails.application.secrets.twitter['enabled'] == true + end def twitter_client Twitter::REST::Client.new do |config| @@ -20,5 +23,3 @@ module TwitterHelper twitter_client.user_timeline(twitter_handle).select{ |tweet| tweet.text.start_with?('RT','@')==false} end end - -# unless Rails.application.secrets.twitter['enabled'] == false diff --git a/app/views/twitter/_index.html.erb b/app/views/twitter/_index.html.erb index 3dab567..8ac65be 100644 --- a/app/views/twitter/_index.html.erb +++ b/app/views/twitter/_index.html.erb @@ -1,3 +1,4 @@ +<% if twitter_enabled == true %>
+<% end %> -- cgit v1.2.3