Rails5とrefile
2016/10/17 | Ruby on Rails
Rails5に画像投稿できるgem, refileを入れてみました。
rails 5.0.0.1
ruby 2.3.1p112
[code lang=”rails” title=”Gemfile”]
gem "refile", require: "refile/rails"
gem "refile-mini_magick"
[/code]
bundle install
当初はGemfileに上記コードを入れて試してみましたが、以下エラー。
[code]
Bundler could not find compatible versions for gem "capistrano":
In Gemfile:
capistrano (~> 3.0.1)
capistrano-rails (~> 1.1.0) was resolved to 1.1.0, which depends on
capistrano-bundler (>= 1.0.0) was resolved to 1.1.3, which depends on
capistrano (~> 3.1)
capistrano-rails (~> 1.1.0) was resolved to 1.1.0, which depends on
capistrano (>= 3.0.0)
capistrano-rvm (~> 0.1.1) was resolved to 0.1.2, which depends on
capistrano (~> 3.0)
Bundler could not find compatible versions for gem "rack":
In Gemfile:
rails (>= 5.0.0.1, ~> 5.0.0) was resolved to 5.0.0.1, which depends on
actionpack (= 5.0.0.1) was resolved to 5.0.0.1, which depends on
rack (~> 2.0)
better_errors was resolved to 2.1.1, which depends on
rack (>= 0.9.0)
capybara was resolved to 2.10.1, which depends on
rack (>= 1.0.0)
refile-mini_magick was resolved to 0.1.0, which depends on
refile (~> 0.5) was resolved to 0.5.0, which depends on
sinatra (~> 1.4.5) was resolved to 1.4.5, which depends on
rack (~> 1.4)
sass-rails (~> 5.0) was resolved to 5.0.6, which depends on
sprockets (< 4.0, >= 2.8) was resolved to 3.7.0, which depends on
rack (< 3, > 1)
devise was resolved to 4.2.0, which depends on
warden (~> 1.2.3) was resolved to 1.2.6, which depends on
rack (>= 1.0)
devise was resolved to 4.2.0, which depends on
warden (~> 1.2.3) was resolved to 1.2.6, which depends on
rack (>= 1.0)</code>
[/code]
となり、rails5にインストールできませんでした。いろいろ探してみると
[code lang=”rails” title=”Gemfile”]
gem "refile", require: "refile/rails", github: ‘manfe/refile’
gem "refile-mini_magick"
[/code]
を見つけたので、これに書き換え、
bundle install
これで無事にrefileが入りました。もしできない場合はGemfile.lockを一度削除してから試してみてください。
imagemagicが必要ですので、もし入れていない場合は入れてください。
brew install imagemagick #mac OSX