Skip to content

Instantly share code, notes, and snippets.

@joseluistorres
Created September 15, 2014 20:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joseluistorres/74b36b399c809574ecc3 to your computer and use it in GitHub Desktop.
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.
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