How to install Refinery CMS using Rails 4

百般思念 提交于 2019-12-04 07:17:04
Ben

Well, my five cents are that Refinery is not yet available for Rails 4:

Best, Ben.

The latest code supports Rails 4; the gem must be sourced from the master branch, until a release is made.

Git Issue #2428 - Rails 4 support

Add to your Gemfile:

gem 'refinerycms-i18n', github: 'refinery/refinerycms-i18n', branch: 'master'
gem 'refinerycms', github: 'refinery/refinerycms', branch: "master"
# Strong parameters is a new feature not used by Refinery
gem 'protected_attributes'

Do a:

$ bundle install 

Create a new Refinery app, the command will be different depending on what you want to do. For that there are a few guides that you can follow. In my case, I added it to an existing app with:

$ rails generate refinery:cms --fresh-installation

Start your server and go to: http://localhost:3000/refinery

Simply initialize the application using:

rails new my_new_application -m http://refinerycms.com/t/edge

Behind the scenes: This command makes your application use the master branch of refinery, which supports Rails 4.

Update Although the above is the easiest and official way, it didn't totally work for me. I had to manually run the following command after the above one:

 rails generate refinery:cms --fresh-installation

Looks like the rails4 branch has been getting a bit of love over the past few days:

https://github.com/refinery/refinerycms/tree/rails4

I will try it out and update with how I get on.

OK, let's try and answer this one. This is the route I went down.

First, I installed the refinerycms gem.

gem install refinerycms

I then did a:

rbenv rehash

Then I followed the guide:

refinerycms rickrockstar

Bundler complained:

Bundler could not find compatible versions for gem "refinerycms-core":
  In Gemfile:
    refinerycms (~> 3.0) ruby depends on
      refinerycms-images (= 3.0.0) ruby depends on
        refinerycms-core (= 3.0.0) ruby

refinerycms (~> 3.0) ruby depends on
  refinerycms-images (= 3.0.0) ruby depends on
    refinerycms-core (= 3.0.0) ruby

refinerycms (~> 3.0) ruby depends on
  refinerycms-images (= 3.0.0) ruby depends on
    refinerycms-core (= 3.0.0) ruby

refinerycms (~> 3.0) ruby depends on
  refinerycms-images (= 3.0.0) ruby depends on
    refinerycms-core (= 3.0.0) ruby

refinerycms-wymeditor (>= 1.0.6, ~> 1.0) ruby depends on
  refinerycms-core (>= 3.0.0, ~> 3.0) ruby

refinerycms-acts-as-indexed (>= 1.0.0, ~> 1.0) ruby depends on
  refinerycms-core (~> 2.1.0) ruby

In my gemfile, I changed the following lines: gem 'rails', '4.2.4'

gem 'refinerycms'
gem 'refinerycms-acts-as-indexed'
gem 'refinerycms-wymeditor'

And this solved the issue.

I had to then do a:

bundle install

Then a:

rails generate refinery:cms --fresh-installation

I posted an issue on github and got the following answer from the RefineryTeam:

 It looks like the culprit was refinerycms-acts-as-indexed version - it should be ~> 2.0.1 to work with Refinery 3.0.0

https://github.com/refinery/refinerycms/issues/3072

Please also see this page where things might be running more smoothly than following the guide on Refinery's website. What is to be seen there is similar to Zuhaib Ali's answer above (in a bit more details).

Hope this helps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!