app/controllers/concerns/adminpanel/twitter_actions.rb in adminpanel-2.2.5 vs app/controllers/concerns/adminpanel/twitter_actions.rb in adminpanel-2.3.0
- old
+ new
@@ -1,22 +1,22 @@
module Adminpanel
module TwitterActions
extend ActiveSupport::Concern
included do
- before_filter :get_twitter_token, only:[:index, :create, :update, :destroy, :show, :twitter_publish]
+ before_action :get_twitter_token, only:[:index, :create, :update, :destroy, :show, :twitter_publish]
end
def twitter_publish
- resource.twitter_message = params[model_name][:twitter_message]
- if !@twitter_token.nil? && !@twitter_secret.nil? && resource.has_valid_tweet?
+ @resource_instance.twitter_message = params[model_name][:twitter_message]
+ if !@twitter_token.nil? && !@twitter_secret.nil? && @resource_instance.has_valid_tweet?
client = get_twitter_token
- client.update(resource.twitter_message)
+ client.update(@resource_instance.twitter_message)
flash[:success] = I18n.t('twitter.posted', user: @twitter_token.name)
else
flash[:error] = I18n.t('twitter.not-posted')
end
- redirect_to resource
+ redirect_to @resource_instance
end
private
def get_twitter_token
@twitter_token = Auth.find_by_key 'twitter-token'