Skip to content

Commit

Permalink
Add instructions to convert rails-5 API only app to rails app before …
Browse files Browse the repository at this point in the history
…setting react-on-rails (shakacode#978)
  • Loading branch information
divya2661 authored and justin808 committed Nov 14, 2017
1 parent 23a59cf commit a42a95a
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ React on Rails integrates Facebook's [React](https://github.com/facebook/react)
- [Initializer Configuration: config/initializers/react_on_rails.rb](#initializer-configuration)
- [Including your React Component in your Rails Views](#including-your-react-component-in-your-rails-views)
- [I18n](#i18n)
- [Convert rails-5 API only app to rails app](#convert-rails-5-api-only-app-to-rails-app)
+ [How it Works](#how-it-works)
- [Client-Side Rendering vs. Server-Side Rendering](#client-side-rendering-vs-server-side-rendering)
- [Building the Bundles](#building-the-bundles)
Expand Down Expand Up @@ -187,6 +188,7 @@ To upgrade existing apps to React on Rails 8 see the [Installation Overview](doc

**For more detailed instructions on a fresh Rails app**, see the [React on Rails Basic Tutorial](docs/tutorial.md).

**If you have rails-5 API only project**, Then [convert rails-5 API only app to rails app](#convert-rails-5-api-only-app-to-rails-app) before [getting started](#getting-started-with-an-existing-rails-app).
1. Add the following to your Gemfile and `bundle install`. We recommend fixing the version of React on Rails, as you will need to keep the exact version in sync with the version in your `client/package.json` file.

```ruby
Expand Down Expand Up @@ -276,6 +278,27 @@ React on Rails provides an option for automatic conversions of Rails `*.yml` loc
See the [How to add I18n](docs/basics/i18n.md) for a summary of adding I18n.
### Convert rails-5 API only app to rails app
1. Go to the directory where you created your app
```
rails new your-current-app-name
```
Rails will start creating the app and will skip the files you have already created. If there is some conflict then it will stop and you need to resolve it manually. be careful at this step as it might replace you current code in conflicted files.
2. Resolve conflicts
```
1. Press "d" to see the difference
2. If it is only adding lines then press "y" to continue
3. If it is removeing some of your code then press "n" and add all additions manually
```
3. Run `bundle install` and follow [Getting started](#getting-started-with-an-existing-rails-app)
## NPM
All JavaScript in React On Rails is loaded from npm: [react-on-rails](https://www.npmjs.com/package/react-on-rails). To manually install this (you did not use the generator), assuming you have a standard configuration, run this command (assuming you are in the directory where you have your `node_modules`):
Expand Down

0 comments on commit a42a95a

Please sign in to comment.