Vote #74170
完了Upgrade to Rails 4.2
0%
説明
Hi,
I want to run redmine on rails 4.
For me (a rails / ruby newbie), it was not a short time task ;), but I'm shure i will rage against this with you help.
I want completed 4 steps, and with it I can run my application, but I have a HTTP/500 error on the welcome controller.
Started GET "/" for 83.217.232.12 at 2013-07-24 13:38:04 +0200
Processing by WelcomeController#index as HTML
WARNING: Can't mass-assign protected attributes for Setting: name
app/models/setting.rb:173:in `find_or_default'
app/models/setting.rb:108:in `[]'
app/models/setting.rb:141:in `rest_api_enabled?'
app/controllers/application_controller.rb:106:in `find_current_user'
app/controllers/application_controller.rb:87:in `user_setup'
Completed 500 Internal Server Error in 3ms
NoMethodError (undefined method `[]' for nil:NilClass):
app/models/setting.rb:95:in `value'
app/models/setting.rb:108:in `[]'
app/models/setting.rb:141:in `rest_api_enabled?'
app/controllers/application_controller.rb:106:in `find_current_user'
app/controllers/application_controller.rb:87:in `user_setup'
- Firstly I remove version called in Gemfile for thos gems
- rails
- jquery-rails
- i18n
- coderay
- fastercsv
- builder
- Secondly, I have added 3 gems (because remove on rails core, for fourth version of this framework).
- gem "protected_attributes"
- gem "actionpack-action_caching", github: "rails/actionpack-action_caching"
- gem "rails-observer"
- Thirdly, I have added config.eager_load to config/environments/*.rb (true on production, false on else)
- Fourthly (and I'm not sure of this), I have remove 3 migrations (I have ot skill to rewrite them)
- 105_build_projects_tree.rb
- 018_set_doc_and_files_notifications.rb
- 20110228000100_copy_repositories_log_encoding.rb
Have you ever tried to migrate redmine to rails 4
journals
--------------------------------------------------------------------------------
#14907 - migrate redmine to rails 4
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Hi,
just checking if there's a plan to add the Rails 4 support yet to do some next-stable Debian release planning.
New rack 1.5 broke rails-3.2, and we would really like to release next stable Debian with as latest rails release as possible by our reverse dependencies.
There's still some time left (about a year) before the archive is frozen, but I would like to be assured that everything will be solved by that time.
Thanks,
O.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
This is first Rails4 porting revision.
* Git
** https://github.com/marutosi/redmine/commit/10fcc9f9a80a97467f660536e0558a0560287c8d
* Mercurial
** https://bitbucket.org/marutosi/redmine-bb-rails4-20131223/commits/060bfbca2061af1508a02b72cd18b6d794a32dfe
Current status
* can run db migrate
* can boot
* can show top page
These are unit test results.
* deprecation warning off
** https://drone.io/bitbucket.org/marutosi/redmine-bb-rails4-20131223/1
* deprecation warning on
** https://drone.io/bitbucket.org/marutosi/redmine-bb-rails4-20131223/2
--------------------------------------------------------------------------------
I rebased on r12470.
* Git
** https://github.com/marutosi/redmine/commit/966eb938ca350fe8fd84377dedc19009c3e64606
* Mercurial
** https://bitbucket.org/marutosi/redmine-bb-rails4-20131227/commits/3ba8aaf0b8047468bd33f320f987470c6ef3dd6b
These are unit test results.
* deprecation warning off
** https://drone.io/bitbucket.org/marutosi/redmine-bb-rails4-20131227/1
* deprecation warning on
** https://drone.io/bitbucket.org/marutosi/redmine-bb-rails4-20131227/2
Rais4 uses *strong parameter* by default.
But, Redmine has many *ActiveRecord.new* and *ActiveRecord.create* at tests.
For examples: source:tags/2.4.2/test/unit/issue_test.rb#L52
So, I use *config.active_record.whitelist_attributes = false*.
--------------------------------------------------------------------------------
I rebased on r12644.
* Git
** https://github.com/marutosi/redmine/commit/ab8c95e689318918c67a24cb39ee354f06ff8a0c
* Mercurial
** https://bitbucket.org/marutosi/redmine-bb-rails4-20140111/commits/c235622c27a703852dd3598b911e6ab05a3a300d
* Tests on Travis
** https://travis-ci.org/marutosi/redmine/builds/16771904
I removed almost all deprecating warnings.
But, *awesome_nested_set* and *acts_as_activity_provider* have many deprecating warnings.
So, I use ActiveSupport::Deprecation.silence.
<pre><code class="ruby">
ActiveSupport::Deprecation.silence do
scope.all(provider_options[:find_options].dup)
end
</code></pre>
awesome_nested_set master branch requires Rails4.
https://travis-ci.org/marutosi/redmine/builds/16771785
Redmine on Rails3 tests fail on awesome_nested_set 2-1-stable branch.
https://travis-ci.org/marutosi/redmine/builds/16771672
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
I rebased on trunk r12884.
* Git
** https://github.com/marutosi/redmine/commit/ab9ccb153927fc056ec1e8be9e18ba9d24603e77
* Mercurial
** https://bitbucket.org/marutosi/redmine-bb-rails4-20140214/commits/aeb8bc4b4cfecc7f74af80f9f846b6dd3d7ff7fb
* Tests on Travis
** https://travis-ci.org/marutosi/redmine/builds/18922992
Previous revision uses awesome_nested_set 2.1.6 removing Rails4 deprecate warning.
Gemfile:
<pre>
gem "awesome_nested_set",
:git => "git://github.com/marutosi/awesome_nested_set.git",
# PR 230, 231 and 232
:ref => "4c4fdfe80f7451b"
</pre>
So, DB migration of PostgreSQL fails.
https://travis-ci.org/marutosi/redmine/jobs/18922993
<pre>
== 105 BuildProjectsTree: migrating ===========================================
rake aborted!
An error has occurred, this and all later migrations canceled:
PG::GroupingError: ERROR: column "projects.id" must appear
in the GROUP BY clause or be used in an aggregate function
LINE 1: ...lft" HAVING COUNT("projects"."lft") > 1 ORDER BY "projects"...
^
: SELECT "projects"."lft", COUNT("projects"."lft") FROM "projects"
GROUP BY "projects"."lft" HAVING COUNT("projects"."lft") > 1
ORDER BY "projects"."id" ASC LIMIT 1
/home/travis/.rvm/gems/ruby-1.9.3-p484/bundler/gems/rails-702f3dca61f1/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:791:in `async_exec'
</pre>
awesome_nested_set master branch and 2-1-stable branch have regression.
* 2-1-stable: fix ActiveRecord::StatementInvalid: Error: Column 'lft' in order clause is ambiguous
** https://github.com/collectiveidea/awesome_nested_set/pull/235
So, tests using awesome_nested_set master branch fails.
* https://github.com/marutosi/redmine/commit/9d3d630b1b7be82cadd6521c81dd9f4254513c91
* https://travis-ci.org/marutosi/redmine/builds/18923425
--------------------------------------------------------------------------------
> Gemfile:
> <pre>
gem "awesome_nested_set",
:git => "git://github.com/marutosi/awesome_nested_set.git",
# PR 230, 231 and 232
:ref => "4c4fdfe80f7451b"
</pre>
I don't like that, we should either use the official gem or bundle it in Redmine as it was before with the appropriate fix.
--------------------------------------------------------------------------------
I rebased on r13171.
* Git
** https://github.com/marutosi/redmine/commit/064007e5cb0504db6f1920fb59f3396172f65c16
* Mercurial
** https://bitbucket.org/marutosi/redmine-bb-rails4-20140526/commits/92689ce415c397afeee9717085461670cfe09e60
* Tests on Travis
** https://travis-ci.org/marutosi/redmine/builds/25998084
--------------------------------------------------------------------------------
JFTR now that rails 4.1 is out - redmine should target rails 4.1 instead of rails 4.0.
Do you have any idea when that happens?
--------------------------------------------------------------------------------
4.1 indeed. It should happen in fall.
--------------------------------------------------------------------------------
@Toshi, we're not targeting Rails 4.0. The branch /sandbox/rails-4.1 is working with Rails 4.1, please don't make changes for 4.0 compatibility/warnings.
--------------------------------------------------------------------------------
Sorry.
I need feedback to Rails team that JPL fixed this Rails 4.0 issue.
https://github.com/rails/rails/issues/15471
And I need feedback to awesome_nested_set author.
https://github.com/collectiveidea/awesome_nested_set/pull/242
There is only one DEPRECATION WARNING on Rails 4.0.
https://travis-ci.org/marutosi/redmine/jobs/29510718#L2074
<pre>
DEPRECATION WARNING: You didn't set config.secret_key_base.
Read the upgrade documentation to learn more about this new config option.
(called from env_config
at /home/travis/.rvm/gems/ruby-1.9.3-p545/gems/railties-4.0.8/lib/rails/application.rb:141)
</pre>
--------------------------------------------------------------------------------
On r13312, some tests fail on Travis.
https://travis-ci.org/marutosi/redmine-bb/jobs/29816929
On my console, following test fails
<pre>
$ ruby test/unit/issue_test.rb
1) Failure:
IssueTest#test_visible_scope_for_member_with_groups_should_return_assigned_issues [test/unit/issue_test.rb:295]:
Failed assertion, no message given.
</pre>
--------------------------------------------------------------------------------
Any news on if RedMine will migrate to Rails 4.1?
So far there has been 3 updates (4.1.4) over time and changes are not feature breaking.
I would recommend now would be a good time to start migrating to rails 4.1
I am going to give it a shot and see how far I can go.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Saimon Lovell wrote:
> Any news on if RedMine will migrate to Rails 4.1?
> So far there has been 3 updates (4.1.4) over time and changes are not feature breaking.
> I would recommend now would be a good time to start migrating to rails 4.1
>
> I am going to give it a shot and see how far I can go.
Hi Saimon,
any progress on that ? If you got some repo on github for that please let me know.
I would be quite happy if I could help.
--
Regards,
Robert
--------------------------------------------------------------------------------
Robert Weclawski wrote:
> any progress on that ? If you got some repo on github for that please let me know.
* https://github.com/marutosi/redmine-bb/commits/bb-svn-rails4.1
* https://bitbucket.org/marutosi/redmine-bb-svn-rails.4.1
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Rails 4.2 is about to be released and will be the last 4.x branch. When Rails 5 is out, only Rails 4.2 will get bug fixes (security fixes only for previous versions). So we should target Rails 4.2 for Redmine 3.x.
--------------------------------------------------------------------------------
I've done the upgrade to Rails 4.2 (not yet committed) but there are still some issues:
* latest release of @awesome_nested_set@ (3.0.1) is not compatible, this patch is needed:
https://github.com/collectiveidea/awesome_nested_set/commit/2f3f28baf71f4964cedcc2548b51e2a4671e8e10
* the rbpdf gem uses @ActionView::Base.sanitized_allowed_css_properties=@ which is deprecated in Rails 4.2
* the sqlserver adapter is not compatible with Rails 4.2, so no SQLServer support for now:
https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/issues/367
--------------------------------------------------------------------------------
Jean-Philippe Lang wrote:
> * latest release of @awesome_nested_set@ (3.0.1) is not compatible, this patch is needed:
> https://github.com/collectiveidea/awesome_nested_set/commit/2f3f28baf71f4964cedcc2548b51e2a4671e8e10
I reported awesome_nested_set 3.0.1 break Redmine.
https://github.com/collectiveidea/awesome_nested_set/issues/280
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Toshi MARUYAMA wrote:
> I reported awesome_nested_set 3.0.1 break Redmine.
> https://github.com/collectiveidea/awesome_nested_set/issues/280
The error you reported should be fixed in Redmine.
The error with awesome_nested_set 3.0.1 and Rails4.2 is: @NoMethodError: undefined method `join_sql' for #<Arel::SelectManager:0xa907c58>@. #join_sql was replaced in the above commit:
https://github.com/collectiveidea/awesome_nested_set/commit/2f3f28baf71f4964cedcc2548b51e2a4671e8e10
--------------------------------------------------------------------------------
Jean-Philippe Lang wrote:
> I've done the upgrade to Rails 4.2 (not yet committed) but there are still some issues:
>
> * latest release of @awesome_nested_set@ (3.0.1) is not compatible, this patch is needed:
> https://github.com/collectiveidea/awesome_nested_set/commit/2f3f28baf71f4964cedcc2548b51e2a4671e8e10
This is no longer an issue due to #18860.
> * the rbpdf gem uses @ActionView::Base.sanitized_allowed_css_properties=@ which is deprecated in Rails 4.2
I've relayed this issue to Jun as https://github.com/naitoh/rbpdf/issues/8.
--------------------------------------------------------------------------------
On r13893, PostgreSQL migration fails.
https://travis-ci.org/marutosi/redmine-bb/jobs/47402990#L1278
<pre>
== 20091114105931 AddViewIssuesPermission: migrating ==========================
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
can't convert Symbol into String
/home/travis/build/marutosi/redmine-bb/app/models/role.rb:99:in `include?'
</pre>
--------------------------------------------------------------------------------
I have created issue on Rails GitHub.
Rails 4.2 SQLite3 regression: Encoding::UndefinedConversionError: "\xE9" from ASCII-8BIT to UTF-8
https://github.com/rails/rails/issues/18580
--------------------------------------------------------------------------------
I've reported another regression with sqlite:
https://github.com/rails/rails/issues/18585
--------------------------------------------------------------------------------
On console, IssueTest#test_visible_scope_for_member_with_groups_should_return_assigned_issues always fails.
<pre>
1) Failure:
IssueTest#test_visible_scope_for_member_with_groups_should_return_assigned_issues [test/unit/issue_test.rb:324]:
Failed assertion, no message given.
</pre>
--------------------------------------------------------------------------------
Mischa The Evil wrote:
> Jean-Philippe Lang wrote:
> > * the rbpdf gem uses @ActionView::Base.sanitized_allowed_css_properties=@ which is deprecated in Rails 4.2
>
> I've relayed this issue to Jun as https://github.com/naitoh/rbpdf/issues/8.
This problem fixed by rbpdf 1.18.5.
please bundle update.
--------------------------------------------------------------------------------
Jun NAITOH wrote:
> This problem fixed by rbpdf 1.18.5.
> please bundle update.
Gemfile updated to ~>1.18.5, thanks!
--------------------------------------------------------------------------------
SQLServer compatibility is now fixed.
--------------------------------------------------------------------------------
This issue is closed and we dropped awesome_nested_set gem (#18860) in version:3.0.0.
But I record some my works.
Jean-Philippe Lang wrote:
> Toshi MARUYAMA wrote:
> > I reported awesome_nested_set 3.0.1 break Redmine.
> > https://github.com/collectiveidea/awesome_nested_set/issues/280
>
> The error you reported should be fixed in Redmine.
Following change fixes on Redmine trunk r13839 (last trunk revision with awesome_nested_set)
with awesome_nested_set 3.0.1.
<pre><code class="diff">
diff --git a/app/models/issue.rb b/app/models/issue.rb
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -185,7 +185,7 @@ class Issue < ActiveRecord::Base
# the lock_version condition should not be an issue but we handle it.
def destroy
super
- rescue ActiveRecord::RecordNotFound
+ rescue ActiveRecord::StaleObjectError, ActiveRecord::RecordNotFound
# Stale or already deleted
begin
reload
</code></pre>
But awesome_nested_set 3.0.2 breaks Redmine.
<pre>
1) Error:
IssueTest#test_visible_and_nested_set_scopes:
ActiveRecord::ActiveRecordError: Impossible move, target node cannot be inside moved tree.
app/models/issue.rb:1374:in `update_nested_set_attributes'
app/models/issue.rb:173:in `create_or_update'
test/object_helpers.rb:93:in `generate!'
test/unit/issue_test.rb:360:in `test_visible_and_nested_set_scopes'
</pre>
This is caused by this change.
https://github.com/collectiveidea/awesome_nested_set/commit/87d8c7cc94eadf08
--------------------------------------------------------------------------------
Jean-Philippe Lang wrote:
> SQLServer compatibility is now fixed.
As Toshi noticed (message#45925) they chose to break compatibility with @MSSQL@ < 2012 which is a bit brutal.
Specifying Rails ~> 4.1 in Gemfile seems to do the trick with trunk @ r14520, do you know if some of the changes that were made when switching from 4.1 to 4.2 aren't 4.1 compatible?
--------------------------------------------------------------------------------
Etienne Massip wrote:
> Specifying Rails ~> 4.1 in Gemfile seems ...
FTR: #20603
--------------------------------------------------------------------------------
related_issues
relates,Closed,15367,Replace outdated awesome_nested_set by gem
relates,Closed,14371,Drop Ruby 1.8.7 support
relates,Closed,12097,Multi Thread Support
relates,Closed,18174,Rails-4.1 branch merge into trunk (r13482) reverts trunk commits
relates,Closed,18192,LDAP tests not running with Rails 4.1
relates,Closed,18429,Error raised on project settings after project wiki is deleted
relates,Closed,18275,First argument in form cannot contain nil or be empty error on revision view
duplicates,Closed,14907,Rails 4.0 Support