Sha256: e2ddaf30f701f0ad3152692c758754cf0df106d2ef913010ad9a73de9c82ad89

Contents?: true

Size: 591 Bytes

Versions: 1

Compression:

Stored size: 591 Bytes

Contents

module Rosetta
  class LocalesController < ApplicationController
    def index
      @locales = [ Locale.default_locale ] + Locale.all
    end

    def new
      @locale = Locale.new
    end

    def create
      @locale = Locale.new(locale_params)

      if @locale.save
        redirect_to locales_path
      else
        render turbo_stream: turbo_stream.update(
          :dialog_content,
          partial: "form",
          locals: { locale: @locale }
        )
      end
    end

    private

    def locale_params
      params.require(:locale).permit(:name, :code)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rosetta-rails-0.1.1 app/controllers/rosetta/locales_controller.rb