Add documentation to customize other Ruby classes
This commit is contained in:
@@ -37,6 +37,7 @@
|
|||||||
* [Controllers](customization/controllers.md)
|
* [Controllers](customization/controllers.md)
|
||||||
* [Views and HTML](customization/views.md)
|
* [Views and HTML](customization/views.md)
|
||||||
* [Components](customization/components.md)
|
* [Components](customization/components.md)
|
||||||
|
* [Other Ruby classes (GraphQL, lib, mailers, builders)](customization/ruby.md)
|
||||||
* [Gems](customization/gems.md)
|
* [Gems](customization/gems.md)
|
||||||
* [Application configuration](customization/application.md)
|
* [Application configuration](customization/application.md)
|
||||||
|
|
||||||
|
|||||||
@@ -9,5 +9,6 @@
|
|||||||
* [Controllers](controllers.md)
|
* [Controllers](controllers.md)
|
||||||
* [Views and HTML](views.md)
|
* [Views and HTML](views.md)
|
||||||
* [Components](components.md)
|
* [Components](components.md)
|
||||||
|
* [Other Ruby classes (GraphQL, lib, mailers, builders)](ruby.md)
|
||||||
* [Gems](gems.md)
|
* [Gems](gems.md)
|
||||||
* [Application configuration](application.md)
|
* [Application configuration](application.md)
|
||||||
|
|||||||
30
docs/en/customization/ruby.md
Normal file
30
docs/en/customization/ruby.md
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# Customizing other Ruby classes
|
||||||
|
|
||||||
|
Other than models, controllers and components, there are a few other folders containing Ruby code:
|
||||||
|
|
||||||
|
* `app/form_builders/`
|
||||||
|
* `app/graphql/`
|
||||||
|
* `app/lib/`
|
||||||
|
* `app/mailers/`
|
||||||
|
|
||||||
|
The files in these folders can be customized like any other Ruby file (see [customizing models](models.md) for more information).
|
||||||
|
|
||||||
|
For example, in order to customize the `app/form_builders/consul_form_builder.rb` file, create a file `app/form_builders/custom/consul_form_builder.rb` with the following content:
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
load Rails.root.join("app", "form_builders", "consul_form_builder.rb")
|
||||||
|
|
||||||
|
class ConsulFormBuilder
|
||||||
|
# Your custom logic here
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
|
Or, in order to customize the `app/lib/remote_translations/caller.rb` file, create a file `app/lib/custom/remote_translations/caller.rb` with the following content:
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
load Rails.root.join("app", "lib", "remote_translations", "caller.rb")
|
||||||
|
|
||||||
|
class RemoteTranslations::Caller
|
||||||
|
# Your custom logic here
|
||||||
|
end
|
||||||
|
```
|
||||||
@@ -37,6 +37,7 @@
|
|||||||
* [Controladores](customization/controllers.md)
|
* [Controladores](customization/controllers.md)
|
||||||
* [Vistas y HTML](customization/views.md)
|
* [Vistas y HTML](customization/views.md)
|
||||||
* [Componentes](customization/components.md)
|
* [Componentes](customization/components.md)
|
||||||
|
* [Otras clases de Ruby (GraphQL, lib, mailers, builders)](customization/ruby.md)
|
||||||
* [Gemas](customization/gems.md)
|
* [Gemas](customization/gems.md)
|
||||||
* [Configuración de la aplicación](customization/application.md)
|
* [Configuración de la aplicación](customization/application.md)
|
||||||
|
|
||||||
|
|||||||
@@ -9,5 +9,6 @@
|
|||||||
* [Controladores](controllers.md)
|
* [Controladores](controllers.md)
|
||||||
* [Vistas y HTML](views.md)
|
* [Vistas y HTML](views.md)
|
||||||
* [Componentes](components.md)
|
* [Componentes](components.md)
|
||||||
|
* [Otras clases de Ruby (GraphQL, lib, mailers, builders)](ruby.md)
|
||||||
* [Gemas](gems.md)
|
* [Gemas](gems.md)
|
||||||
* [Configuración de la aplicación](application.md)
|
* [Configuración de la aplicación](application.md)
|
||||||
|
|||||||
30
docs/es/customization/ruby.md
Normal file
30
docs/es/customization/ruby.md
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# Personalización de otras clases de Ruby
|
||||||
|
|
||||||
|
Aparte de modelos, controladores y componentes, hay otros directorios que contienen código de Ruby:
|
||||||
|
|
||||||
|
* `app/form_builders/`
|
||||||
|
* `app/graphql/`
|
||||||
|
* `app/lib/`
|
||||||
|
* `app/mailers/`
|
||||||
|
|
||||||
|
Los ficheros en estos directorios pueden personalizarse como cualquier otro fichero de Ruby (véase [personalización de modelos](models.md) para más información).
|
||||||
|
|
||||||
|
Por ejemplo, para personalizar el fichero `app/form_builders/consul_form_builder.rb`, crea el archivo `app/form_builders/custom/consul_form_builder.rb` con el siguiente contenido:
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
load Rails.root.join("app", "form_builders", "consul_form_builder.rb")
|
||||||
|
|
||||||
|
class ConsulFormBuilder
|
||||||
|
# Your custom logic here
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
|
O, para personalizar el fichero `app/lib/remote_translations/caller.rb`, crea el archivo `app/lib/custom/remote_translations/caller.rb` con el siguiente contenido:
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
load Rails.root.join("app", "lib", "remote_translations", "caller.rb")
|
||||||
|
|
||||||
|
class RemoteTranslations::Caller
|
||||||
|
# Your custom logic here
|
||||||
|
end
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user