Class: Interpreter::TranslationsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Interpreter::TranslationsController
- Defined in:
- app/controllers/interpreter/translations_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #search ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'app/controllers/interpreter/translations_controller.rb', line 18 def create @translation = InterpreterTranslation.new params[:interpreter_translation] if @translation.save redirect_to interpreter_translations_url, :notice => "Translation added." else render :action => :new end end |
#destroy ⇒ Object
41 42 43 44 |
# File 'app/controllers/interpreter/translations_controller.rb', line 41 def destroy count = InterpreterTranslation.destroy(params[:id].gsub('-','.')) redirect_to :back, :notice => "Translation destroyed." end |
#edit ⇒ Object
27 28 29 |
# File 'app/controllers/interpreter/translations_controller.rb', line 27 def edit @translation = InterpreterTranslation.find_by_key(params[:id].gsub('-','.')) end |
#index ⇒ Object
4 5 6 |
# File 'app/controllers/interpreter/translations_controller.rb', line 4 def index @translations = InterpreterTranslation.all end |
#new ⇒ Object
14 15 16 |
# File 'app/controllers/interpreter/translations_controller.rb', line 14 def new @translation = InterpreterTranslation.new end |
#search ⇒ Object
8 9 10 11 12 |
# File 'app/controllers/interpreter/translations_controller.rb', line 8 def search @translations = InterpreterTranslation.find_all_by_value_like params[:query] @search_notice = "#{@translations.length} translation#{'s' if @translations.length > 1} found." render :action => :index end |
#update ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'app/controllers/interpreter/translations_controller.rb', line 31 def update @translation = InterpreterTranslation.find_by_key(parse_id(params[:id])) @translation.update_attributes(params[:interpreter_translation]) if @translation.save redirect_to interpreter_translations_url, :notice => "Translation updated." else render :action => :edit end end |