Class: Admin::Api::LanguagesController
- Inherits:
-
Admin::ApiController
- Object
- Admin::ApiController
- Admin::Api::LanguagesController
- Defined in:
- app/controllers/admin/api/languages_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/admin/api/languages_controller.rb', line 11 def create @language = Odania::Language.new(language_params) if @language.save flash[:notice] = t('created') render action: :show else render json: {errors: @language.errors}, status: :bad_request end end |
#destroy ⇒ Object
31 32 33 34 35 36 |
# File 'app/controllers/admin/api/languages_controller.rb', line 31 def destroy @language.destroy flash[:notice] = t('deleted') render json: {message: 'deleted'} end |
#index ⇒ Object
4 5 6 |
# File 'app/controllers/admin/api/languages_controller.rb', line 4 def index @languages = Odania::Language.order('iso_639_1 ASC') end |
#show ⇒ Object
8 9 |
# File 'app/controllers/admin/api/languages_controller.rb', line 8 def show end |
#update ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'app/controllers/admin/api/languages_controller.rb', line 22 def update if @language.update(language_params) flash[:notice] = t('updated') render action: :show else render json: {errors: @language.errors}, status: :bad_request end end |