Class: ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Includes:
ActionView::Helpers::JavaScriptHelper, ActionView::Helpers::PrototypeHelper, ActionView::Helpers::ScriptaculousHelper, ActionView::Helpers::TagHelper, Localization, UserSystem
Defined in:
app/controllers/application.rb

Constant Summary

Constants included from Localization

Localization::LOCALIZED_STRINGS

Class Method Summary collapse

Methods included from Localization

#l, load_localized_strings, #valid_language?

Class Method Details

.in_place_edit_for(object, attribute, options = {}) ⇒ Object



18
19
20
21
22
23
24
# File 'app/controllers/application.rb', line 18

def self.in_place_edit_for(object, attribute, options = {})
  define_method("set_#{object}_#{attribute}") do
    @item = object.to_s.camelize.constantize.find(params[:id])
    @item.update_attribute(attribute, params[:value])
    render :text => @item.send(attribute).to_s
  end
end