Sha256: 84544a3786698544deb9ba6bc1ef1f2f28ad56f4d5d08f520e310f6911d3c3be

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

if defined?(ActionController) and defined?(ActionController::Base)

  class ActionController::Base
    
    prepend_before_filter :initialize_whowish_word
    attr_accessor :whowish_word_config


    def initialize_whowish_word
      @whowish_word_config = WhowishWord::Config.new
      $whowish_word_config = @whowish_word_config
    end


    helper_method :whowish_word
    
    def whowish_word
      return @whowish_word_config
    end


    def word_for(namespace, id, *variables)
      
      if @whowish_word_config.edit_mode == true
        return WhowishWord.word_for_in_edit_mode(namespace, id, @whowish_word_config.locale, *variables)
      else
        return WhowishWord.word_for(namespace, id, @whowish_word_config.locale, *variables)
      end
      
    end
    
    
    def word_for_attr(namespace, id, *variables)
      
      if @whowish_word_config.edit_mode == true
        return WhowishWord.word_for_attr_in_edit_mode(namespace, id, @whowish_word_config.locale, *variables)
      else
        return WhowishWord.word_for_attr(namespace, id, @whowish_word_config.locale, *variables)
      end
      
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
whowish_word-0.3.3 lib/whowish_word/action_controller/base.rb