Created
September 15, 2014 20:55
-
-
Save joseluistorres/74b36b399c809574ecc3 to your computer and use it in GitHub Desktop.
then I want a method that is executed for create / edit actions, that use @my_var1, and can set variables available in the view.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TestsController < ApplicationController | |
before_filter :execute_me, :only => :index | |
def index | |
@my_var2 = translate_me('ES', @my_var) | |
end | |
private | |
def execute_me | |
@my_var = 'Hi' | |
end | |
def translate_me(some_language, some_value) | |
if some_language=='ES' | |
'hola' | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment