Class: LocalesController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- LocalesController
- Defined in:
- lib/controllers/locales_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /locales POST /locales.xml.
-
#destroy ⇒ Object
DELETE /locales/1 DELETE /locales/1.xml.
-
#edit ⇒ Object
GET /locales/1/edit.
-
#index ⇒ Object
GET /locales GET /locales.xml.
-
#new ⇒ Object
GET /locales/new GET /locales/new.xml.
-
#show ⇒ Object
GET /locales/1 GET /locales/1.xml.
-
#update ⇒ Object
PUT /locales/1 PUT /locales/1.xml.
Instance Method Details
#create ⇒ Object
POST /locales POST /locales.xml
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/controllers/locales_controller.rb', line 43 def create @locale = Locale.new(params[:locale]) respond_to do |format| if @locale.save flash[:notice] = 'Locale was successfully created.' format.html { redirect_to(@locale) } format.xml { render :xml => @locale, :status => :created, :location => @locale } else format.html { render :action => "new" } format.xml { render :xml => @locale.errors, :status => :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /locales/1 DELETE /locales/1.xml
77 78 79 80 81 82 83 84 85 |
# File 'lib/controllers/locales_controller.rb', line 77 def destroy @locale = Locale.find_by_code(params[:id]) @locale.destroy respond_to do |format| format.html { redirect_to(locales_url) } format.xml { head :ok } end end |
#edit ⇒ Object
GET /locales/1/edit
37 38 39 |
# File 'lib/controllers/locales_controller.rb', line 37 def edit @locale = Locale.find_by_code(params[:id]) end |
#index ⇒ Object
GET /locales GET /locales.xml
5 6 7 8 9 10 11 12 |
# File 'lib/controllers/locales_controller.rb', line 5 def index @locales = Locale.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @locales } end end |
#new ⇒ Object
GET /locales/new GET /locales/new.xml
27 28 29 30 31 32 33 34 |
# File 'lib/controllers/locales_controller.rb', line 27 def new @locale = Locale.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @locale } end end |
#show ⇒ Object
GET /locales/1 GET /locales/1.xml
16 17 18 19 20 21 22 23 |
# File 'lib/controllers/locales_controller.rb', line 16 def show @locale = Locale.find_by_code(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @locale } end end |
#update ⇒ Object
PUT /locales/1 PUT /locales/1.xml
60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/controllers/locales_controller.rb', line 60 def update @locale = Locale.find_by_code(params[:id]) respond_to do |format| if @locale.update_attributes(params[:locale]) flash[:notice] = 'Locale was successfully updated.' format.html { redirect_to(@locale) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @locale.errors, :status => :unprocessable_entity } end end end |