Skip to content

Commit

Permalink
Revise configuration-related docs after PR review
Browse files Browse the repository at this point in the history
Thanks to adammathys for his review of this content.
  • Loading branch information
benjaminwil committed Feb 27, 2018
1 parent b386e4f commit 5d4cdc2
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 32 deletions.
33 changes: 33 additions & 0 deletions guides/getting-started/forking-solidus.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Forking Solidus

If your store requires deep customizations to Solidus's core functionality, you
may want to fork Solidus for your store where you can more freely implement your
features.

Note that this can complicate your Solidus upgrade process or can break other
Solidus extensions you may wish to use.

The benefit of using a fork of Solidus is that you can test your new features
with Solidus's test suite and ensure your development has not broken Solidus's
existing functionality.

You can reference a fork of Solidus in your `Gemfile` this way:

```ruby
gem 'solidus', git: 'https://github.com/my_account/solidus.git', branch: "my-new-feature"
```

If you think your feature (or fix) is of interest to the wider Solidus
community, [consider making a pull request][contributing].

[contributing]: https://github.com/solidusio/solidus/blob/master/CONTRIBUTING.md

## Create a "private fork"

If your organization needs to work in a private repository for any reason,
forking Solidus becomes slightly more complicated. GitHub does not allow you to
create private forks of public repositories. Instead, you can duplicate the
repository. See GitHub's [Duplicating a repository][duplicating] article for
more information.

[duplicating]: https://help.github.com/articles/duplicating-a-repository/
23 changes: 0 additions & 23 deletions guides/getting-started/private-solidus-fork.md

This file was deleted.

26 changes: 24 additions & 2 deletions guides/preferences/add-model-preferences.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,30 @@ types are:
An optional default value may be defined. (See the `:dark_chocolate` preference
in the block above.) This is the value used unless another value has been set.

Once you have set preferences, you can access their values from the object
they're set on:
### Add columns for your preferences

In order for your new preferences to persist, you need to add a column to the
relevant model using a migration:

```ruby
class AddPreferencesToSubscriptionRules < ActiveRecord::Migration[5.0]
def change
add_column :my_store_subscription_rules, :preferences, :text
end
end
```

Your new `preferences` column should be the type `text`.

Then, you can run the migration:

```shell
bundle exec rails db:migrate
```

### Access your preferences

Now you can access their values from the model they are set on:

```ruby
MyStore::SubscriptionRules.find(1).preferences
Expand Down
14 changes: 7 additions & 7 deletions guides/preferences/app-configuration.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# App configuration
# App configuration

Solidus includes many preferences with default settings that are appropriate for
typical stores. For a list of Solidus's preferences their default values, see
the [`Spree::AppConfiguration` documentation][app-configuration-documentation].
The [`Spree::AppConfiguration` class][app-configuration-class] is where all of
Solidus's preferences are defined.
typical stores. For a list of Solidus's preferences and their default values,
see the [`Spree::AppConfiguration`
documentation][app-configuration-documentation]. The [`Spree::AppConfiguration`
class][app-configuration-class] is where all of Solidus's preferences are
defined.

The built-in preferences are well-tested options that allow you to implement
complex ecommerce behaviors.
Expand All @@ -18,7 +19,7 @@ initializers. Some default preferences are explicitly set in the initializer at
`config/initializers/spree.rb`.

In this file's first `Spree.config` block, the `currency` and `mails_from`
preferences are given default values you may want to modify:
preferences are given default values you may want to modify:

```ruby
# /config/initializers/spree.rb
Expand Down Expand Up @@ -67,4 +68,3 @@ Spree::Config.currency
[app-configuration-model]: https://github.com/solidusio/solidus/blob/master/core/lib/spree/app_configuration.rb
[app-configuration-documentation]: http://docs.solidus.io/Spree/AppConfiguration.html
[rails-engines]: http://guides.rubyonrails.org/engines.html

0 comments on commit 5d4cdc2

Please sign in to comment.