Ruby on rails 我想将RubyonRails 7.0.0.alpha从git降级到'6.1.3.2'`
…但它仍然使用git版本,尽管已从Ruby on rails 我想将RubyonRails 7.0.0.alpha从git降级到'6.1.3.2'`,ruby-on-rails,gemfile,Ruby On Rails,Gemfile,…但它仍然使用git版本,尽管已从Gemfile中删除,bundle exec没有任何不同: Using activestorage 7.0.0.alpha from https://github.com/rails/rails.git (at main@b678667) Using mail 2.7.1 Using actionmailbox 7.0.0.alpha from https://github.com/rails/rails.git (at main@b678667) Using
Gemfile
中删除,bundle exec
没有任何不同:
Using activestorage 7.0.0.alpha from https://github.com/rails/rails.git (at main@b678667)
Using mail 2.7.1
Using actionmailbox 7.0.0.alpha from https://github.com/rails/rails.git (at main@b678667)
Using actionmailer 7.0.0.alpha from https://github.com/rails/rails.git (at main@b678667)
Using actiontext 7.0.0.alpha from https://github.com/rails/rails.git (at main@b678667)
Using sprockets-rails 3.2.2
Using rails 7.0.0.alpha from https://github.com/rails/rails.git (at main@b678667)
/home/leder/.rbenv/versions/3.0.1/lib/ruby/site_ruby/3.0.0/bundler/runtime.rb:302:in `check_for_activated_spec!': You have already activated activesupport 6.1.3.2, but your Gemfile requires activesupport 7.0.0.alpha. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
更新: 我降级了
active\u storage\u main.rb文件中的rails gem,但现在我有一个不兼容的sprockets
版本,它不在源代码中:
Installing sprockets 4.0.2 (was 3.7.2)
Using sprockets-rails 3.2.2
Using rails 6.1.3.2
/home/leder/.rbenv/versions/3.0.1/lib/ruby/site_ruby/3.0.0/bundler/runtime.rb:302:in `check_for_activated_spec!': You have already activated sprockets 3.7.2, but your Gemfile requires sprockets 4.0.2. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
#冻结的字符串文字:true
需要“bundler/inline”
gemfile(true)do
来源“https://rubygems.org"
#git|u源(:github){| repo |“https://github.com/#{repo}.git}
gem“rails”、“~>6.1.3”、“>=6.1.3.2”
#github:“rails/rails”,分支:“main”
gem“sqlite3”
结束
需要“活动记录/轨道连接”
需要“活动存储/引擎”
需要“tmpdir”
类TestApp# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
#git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "rails", '~> 6.1.3', '>= 6.1.3.2'
#github: "rails/rails", branch: "main"
gem "sqlite3"
end
require "active_record/railtie"
require "active_storage/engine"
require "tmpdir"
class TestApp < Rails::Application
config.root = __dir__
config.hosts << "example.org"
config.eager_load = false
config.session_store :cookie_store, key: "cookie_store_key"
secrets.secret_key_base = "secret_key_base"
config.logger = Logger.new($stdout)
Rails.logger = config.logger
config.active_storage.service = :local
config.active_storage.service_configurations = {
local: {
root: Dir.tmpdir,
service: "Disk"
}
}
end
ENV["DATABASE_URL"] = "sqlite3::memory:"
Rails.application.initialize!
require ActiveStorage::Engine.root.join("db/migrate/20210523072040_create_active_storage_tables.active_storage.rb").to_s
ActiveRecord::Schema.define do
CreateActiveStorageTables.new.change
create_table :users, force: true
end
class User < ActiveRecord::Base
has_one_attached :profile
end
require "minitest/autorun"
class BugTest < Minitest::Test
def test_upload_and_download
user = User.create!(
profile: {
content_type: "text/plain",
filename: "dummy.txt",
io: ::StringIO.new("dummy"),
}
)
assert_equal "dummy", user.profile.download
end
end