<commit_before>= Code

Decidim is multiple things:

* A command line utility, which can create an application
* A set of libraries, that the application can use

Most of the time, you should work with the generated application. That application (development_app on this docs) should be named as your project, for instance for Barcelona City Council is `DecidimBarcelona`, so for creating it should be:

[source,console]
----
decidim DecidimBarcelona
----

If you want to override/change anything (for instance the homepage), you can just do it with the same name of the file, through Monkey Patching.

If you want to extend Decidim, the prefered way should be by having a Module. This is a Ruby on Rails Engine which provides ruby code (models, views, controllers, assets, etc). You can use it through multiple ways:

* Putting it on the same directory as your app and pointing on the Gemfile. https://github.com/AjuntamentdeBarcelona/decidim-barcelona/tree/c210b5338d7ba1338c9879627e081da1441f1946[See example on GitHub]. For instance:

[source,ruby]
----
gem "decidim-debates", path: "decidim-debates"
----

* Publishing on a git repository and pointing in on the Gemfile. For instance:

[source,ruby]
----
gem "decidim-consultations", git: "https://github.com/decidim/decidim-module-consultations"
----
<commit_msg>Add examples on code overriding docs (#7498)<commit_after>= Code

Decidim is multiple things:

* A command line utility, which can create an application
* A set of libraries, that the application can use

Most of the time, you should work with the generated application. That application (development_app on this docs) should be named as your project, for instance for Barcelona City Council is `DecidimBarcelona`, so for creating it should be:

[source,console]
----
decidim DecidimBarcelona
----

If you want to override/change anything, you can just do it with the same name of the file, through Monkey Patching. Some real world examples of this method:

* https://github.com/gencat/participa/blob/master/app/decorators/decidim/admin/selective_newsletter_form_decorator.rb[Decidim::Admin::SelectiveNewsletterForm]. As it's a decorator you also need to make it available in the https://github.com/gencat/participa/blob/3416992ae095f6ab1e826fee961253514c4ff0ef/config/application.rb#L48[application config]
* https://github.com/barcelonaregional/decidim-premet25/blob/master/config/initializers/etiquette_validator.rb[EtiquetteValidator.class_eval]

If you want to extend Decidim, the prefered way should be by having a Module. This is a Ruby on Rails Engine which provides ruby code (models, views, controllers, assets, etc). You can use it through multiple ways:

* Putting it on the same directory as your app and pointing on the Gemfile. https://github.com/AjuntamentdeBarcelona/decidim-barcelona/tree/c210b5338d7ba1338c9879627e081da1441f1946[See example on GitHub]. For instance:

[source,ruby]
----
gem "decidim-debates", path: "decidim-debates"
----

* Publishing on a git repository and pointing in on the Gemfile. For instance:

[source,ruby]
----
gem "decidim-consultations", git: "https://github.com/decidim/decidim-module-consultations"
----

{'fraction_non_alphanumeric': 0.0857232902615821, 'fraction_numerical': 0.02962496060510558, 'mean_word_length': 4.802559414990859, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 7, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3384157', 'n_tokens_mistral': 1017, 'n_tokens_neox': 925, 'n_words': 366}