Feature #4796

Rails 3 support

Added by Eric Davis over 4 years ago. Updated over 2 years ago.

Status:ClosedStart date:2010-02-10
Priority:LowDue date:
Assignee:Jean-Philippe Lang% Done:

100%

Category:Rails support
Target version:2.0.0
Resolution:Fixed

Description

Migrate Redmine to Rails 3 once Rails is out of beta. Must make sure Redmine plugins are still functional and can be ported easily from Rails 2.x.

response_time.png (5.76 KB) Jean-Philippe Lang, 2012-03-02 20:46


Related issues

Related to Defect #8421: REST API may produce invalid json New 2011-05-21
Related to Feature #4005: Setup shoulda to make it easier to test Closed 2009-10-08
Related to Defect #8989: r6351 causes unexpected chars to be displayed in calendar Closed 2011-08-05
Related to Defect #8751: Email notification: bug, when number of recipients more t... Closed 2011-07-06
Related to Patch #6317: Template names conventions Closed 2010-09-07
Related to Defect #9252: Regression: application title escaped 2 times Closed 2011-09-15
Related to Feature #9759: HTML minification and compression New

Associated revisions

Revision 6412
Added by Toshi MARUYAMA about 3 years ago

replace « and » at app/helpers/application_helper.rb to hexadecimal UTF-8 strings (#4796).

Revision 6413
Added by Toshi MARUYAMA about 3 years ago

replace « and » at app/views/search/index.rhtml to hexadecimal UTF-8 strings (#4796).

Revision 6414
Added by Toshi MARUYAMA about 3 years ago

replace « and » at app/views/wiki/show.rhtml to hexadecimal UTF-8 strings (#4796).

Revision 6491
Added by Toshi MARUYAMA about 3 years ago

replace « and » at app/views/gantts/show.html.erb to hexadecimal UTF-8 strings (#4796).

Revision 6515
Added by Toshi MARUYAMA about 3 years ago

replace « and » at app/views/activities/index.html.erb to hexadecimal UTF-8 strings (#4796).

Revision 7246
Added by Toshi MARUYAMA about 3 years ago

backed out r6350 (#9252, #4796)

HTML escape at app/helpers/application_helper.rb

Revision 7591
Added by Toshi MARUYAMA about 3 years ago

Rails3: model: query: parse dates using UTC (ruby 1.9 inside) (#4796)

On Rails 3.0 and Ruby 1.8.7 in Japan (UTC+9), tests fails with following messages.

test_operator_date_equals(QueryTest) [test/unit/query_test.rb:206]:
<"(issues.due_date > '2011-07-09 14:59:59.999999' AND issues.due_date <= '2011-07-10 14:59:59.999999')
AND (issue_statuses.is_closed='f')"> expected to be =~
</issues\.due_date > '2011-07-09 23:59:59(\.9+)?' AND issues\.due_date <= '2011-07-10 23:59:59(\.9+)?/>.

Contributed by Sylvain Utard.

Revision 8304
Added by Toshi MARUYAMA almost 3 years ago

Rails3: rename sample_plugin .rhtml to .html.erb (#6317, #4796)

:rhtml and :rxml were finally removed as template handlers at Rails 3.1 RC4.

Revision 8702
Added by Toshi MARUYAMA almost 3 years ago

Rails3.2: pdf: comment out ::ActionView::TemplateHandlers::ERB of rfpdf plugin (#4796)

ActionView::TemplateHandlers is deprecated on Rails3.2
and Redmine cannot boot on Rails3.2.
Redmine does not use this rfpdf plugin feature.

Revision 8713
Added by Toshi MARUYAMA over 2 years ago

Ruby1.9: set Encoding.default_external on only Rails2 (#4050, #4796)

Revision 8714
Added by Toshi MARUYAMA over 2 years ago

Ruby1.9: enforce UTF-8 encodings on the params hash on Rails2 (#4050, #4796)

Without this change, non ASCII subject issue cannot be created on Ruby 1.9.

Revision 8716
Added by Toshi MARUYAMA over 2 years ago

Ruby1.9: skip enforcing UTF-8 encodings on the params hash on Rails2 if it is frozen (#4050, #4796)

Tests on CI server fail.
http://www.redmine.org/builds/build_trunk-1.9.2-sqlite3_257.html

  1) Error:
test_index_with_short_filters(IssuesControllerTest):
RuntimeError: can't modify frozen string
    /var/lib/hudson/jobs/trunk-1.9.2-sqlite3/workspace/app/controllers/application_controller.rb:58:in `force_encoding'
    /var/lib/hudson/jobs/trunk-1.9.2-sqlite3/workspace/app/controllers/application_controller.rb:58:in `utf8nize!'
    /var/lib/hudson/jobs/trunk-1.9.2-sqlite3/workspace/app/controllers/application_controller.rb:60:in `block in utf8nize!'
    /var/lib/hudson/jobs/trunk-1.9.2-sqlite3/workspace/app/controllers/application_controller.rb:60:in `each'
    /var/lib/hudson/jobs/trunk-1.9.2-sqlite3/workspace/app/controllers/application_controller.rb:60:in `utf8nize!'
    /var/lib/hudson/jobs/trunk-1.9.2-sqlite3/workspace/app/controllers/application_controller.rb:52:in `params_filter'
    /var/lib/hudson/ruby1.9.2/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:178:in `evaluate_method'
    /var/lib/hudson/ruby1.9.2/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:166:in `call'
    /var/lib/hudson/ruby1.9.2/lib/ruby/gems/1.9.1/gems/actionpack-2.3.14/lib/action_controller/filters.rb:225:in `call'
    /var/lib/hudson/ruby1.9.2/lib/ruby/gems/1.9.1/gems/actionpack-2.3.14/lib/action_controller/filters.rb:629:in `run_before_filters'
    /var/lib/hudson/ruby1.9.2/lib/ruby/gems/1.9.1/gems/actionpack-2.3.14/lib/action_controller/filters.rb:615:in `call_filters'
    /var/lib/hudson/ruby1.9.2/lib/ruby/gems/1.9.1/gems/actionpack-2.3.14/lib/action_controller/filters.rb:610:in `perform_action_with_filters'
    /var/lib/hudson/ruby1.9.2/lib/ruby/gems/1.9.1/gems/actionpack-2.3.14/lib/action_controller/benchmarking.rb:68:in `block in perform_action_with_benchmark'
    /var/lib/hudson/ruby1.9.2/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/core_ext/benchmark.rb:17:in `block in ms'

Revision 8742
Added by Toshi MARUYAMA over 2 years ago

Rails3: add number.format to ro and sk locales (#4796)

Test fails on Rails 3.0.11 and Ruby 1.8.7.

Failure:
test_number_to_human_size_for_each_language(Redmine::I18nTest)
    [test/unit/lib/redmine/i18n_test.rb:114:in `test_number_to_human_size_for_each_language'
     test/unit/lib/redmine/i18n_test.rb:112:in `each'
     test/unit/lib/redmine/i18n_test.rb:112:in `test_number_to_human_size_for_each_language']:
sk failure.
Exception raised:
TypeError(<can't convert nil into String>)

Revision 8833
Added by Toshi MARUYAMA over 2 years ago

Ruby1.9: move setting Encoding.default_external after boot (#4050, #4796)

"ruby test/functional/repositories_git_controller_test.rb" fails
on Japanese Windows and Mingw Ruby 1.9.3p0
because "Rails" is not defined.

History

#2 Updated by Eric Davis about 4 years ago

  • Assignee deleted (Eric Davis)

#3 Updated by Luiz Picanço almost 4 years ago

Any news about this ?

#4 Updated by John Yani almost 4 years ago

1.2.0 will stick with 2.3.10 (#6887)

Maybe after 1.2.0 release something will be clearer. What is engines support BTW?

#5 Updated by Eric Thomas almost 4 years ago

John Yani wrote:

1.2.0 will stick with 2.3.10 (#6887)

Maybe after 1.2.0 release something will be clearer. What is engines support BTW?

The next release of rails (3.1) will have engines support.

#6 Updated by Felix Schäfer almost 4 years ago

Eric Thomas wrote:

The next release of rails (3.1) will have engines support.

Source/link? I fear they won't work exactly like the ones in 2.3 did, i.e. we still have to evaluate exactly what changes and how that affects us.

#7 Updated by Jean-Baptiste Barth almost 4 years ago

Sources: rails-engines site, the blog of Piotr Sarnacki, and I've got some bookmarks about the transition at home.

What's sure for now:
  • Rails 3.0 supports a kind of Engines, but there's no mechanism for migrations, nor copying assets automatically (nor overriding views iirc) ; for sure they're not useable in Redmine at this point
  • Rails 3.1 Engines will support these kind of things (needs to be precised I know), but all documentation I read on Rails3' engines makes me think that plugin developers would have to package their plugin as a gem
  • Redmine cannot support Rails 2.3.x and Rails 3.x at the same time :)

#8 Updated by Etienne Massip over 3 years ago

Just a note about .xml format : Rails 3 does not include Builder anymore, it's now one of its dependencies.

#9 Updated by Toshi MARUYAMA over 3 years ago

  • Category set to Rails support

#10 Updated by Etienne Massip over 3 years ago

Jean-Baptiste Barth wrote:

  • Rails 3.0 supports a kind of Engines, but there's no mechanism for migrations, nor copying assets automatically (nor overriding views iirc) ; for sure they're not useable in Redmine at this point
  • Rails 3.1 Engines will support these kind of things (needs to be precised I know), but all documentation I read on Rails3' engines makes me think that plugin developers would have to package their plugin as a gem

Indeed, Rails 3.1 RC is out and supports migrations as well as moutable apps, see http://weblog.rubyonrails.org/2011/5/22/rails-3-1-release-candidate.

Notes- :

Rails 3 applications include a Gemfile and support the use of Bundler (see http://weblog.rubyonrails.org/2010/8/29/rails-3-0-it-s-done).
Rails 3.1 default scripting lib is now jQuery instead of Prototype.

#11 Updated by Fabian Becker over 3 years ago

Is there any update on migrating to Rails 3.x? It's becoming a pain maintaining Redmine as it currently is. Upgrading to 3.0/3.1RC would definitely improve the development process.

I do understand that you are having trouble loosing compatibility to lots of good Redmine plugins, so I suggest you start Redmine + Rails 3.1RC development on a seperate branch and publish Redmine for both Rails versions in a transitional period (maybe 1 year?) giving all plugin developers time to migrate their plugins to a Rails Engine.

Any thoughts?

#12 Updated by Etienne Massip over 3 years ago

  • Target version set to Candidate for next major release

Fabian Becker wrote:

It's becoming a pain maintaining Redmine as it currently is.

Can't see why ?

#15 Updated by Etienne Massip over 3 years ago

You should try to make it work straight with Rails 3.1 (rc4 is the last release) since (I guess) Redmine will never run with 3.0 due to the lack of engine support.

Moreover, you might detect and report some Rails 3.1 rc issues whic could be fixed before release time, making it easier to integrate with RM.

BTW, do you run Rails 3 RM with Ruby 1.9 ?

#17 Updated by Etienne Massip over 3 years ago

RoR team is organizing a hack fest for 3.1 : http://weblog.rubyonrails.org/2011/7/14/rails-3-1-hackfest

#20 Updated by Toshi MARUYAMA about 3 years ago

http://mrjaba.posterous.com/ruby-news-roundup-06-04-2011

:rhtml and :rxml were finally removed as template handlers.

#21 Updated by Etienne Massip about 3 years ago

Nice job on routes =)

Got some nice reading for you: http://www.h-online.com/open/features/From-Rails-2-3-to-3-0-1285884.html

Edit: permalink: http://h-online.com/-1285884

#22 Updated by Luiz Picanço about 3 years ago

Interesting article !

Etienne Massip wrote:

Nice job on routes =)

Got some nice reading for you: http://www.h-online.com/open/features/From-Rails-2-3-to-3-0-1285884.html

Edit: permalink: http://h-online.com/-1285884

#23 Updated by David Bennett about 3 years ago

If you need any direction, the Spree project has great 3.0 and 3.1 support: http://spreecommerce.com/blog

The "Extension" system they have is great as you just add a line in your Gemfile that points to a github project and vola! extra features :)

BDQ has also created Deface, A view editor that alters views based on css rules: https://github.com/railsdog/deface

#25 Updated by Etienne Massip about 3 years ago

Another article from the H: http://h-online.com/-1285887

#26 Updated by Alexandre de Oliveira about 3 years ago

So, is there any official announcement regarding 3.x support? A plan? Redmine 2.0? I found nothing on Wiki. Is there anyone leading the efforts to this end?

Because I'd like to contribute to make Redmine Rails 3.x compatible. It's not clear if there's a branch for it. I guess any patch regarding this shouldn't go to master branch, isn't it? It seems Toshi is already doing some work on this. How could I be of help regarding this matter?

Second, don't you agree this is not the correct place for posting about these Rails 3.1's new features articles, like Etienne's?

Thank you.

#27 Updated by Toshi MARUYAMA about 3 years ago

  • % Done changed from 0 to 40

I rebased on r7627.

Git: Mercurial:

If you run with current database of Redmine 1.2 on Rails 2.3.11,
you need to run "rake db:migrate".

In order to run tests,
you need to install object_daddy for Rails 3.1.

ruby script/rails plugin install git://github.com/awebneck/object_daddy.git

The revisions are from following repositories.

Git and Mercurial revisions are synchronized by hg-git .
If you want to improve it, you can choose what you like.

#28 Updated by David Bennett almost 3 years ago

As this is now Rails 3.1... and a lot of things will break in the upgrade anyway.

Would it be a good idea to change this to a mountable engine?
(or even a stranded engine so that users can upgrade by just changing the version in the Gemfile.)

I have experience and can help out if you go down this path.

CON: You may want to namespace everything so it plays nice with other mountable engines.

#29 Updated by Felix Schäfer almost 3 years ago

David, do you have experience with the 3.1 full engines?

#30 Updated by David Bennett almost 3 years ago

Felix Schäfer wrote:

David, do you have experience with the 3.1 full engines?

If by full engines you mean ones with there own logic/models/controllers/migrations that can be added by just adding something to your Gemfile.

Then yes, I use them where ever possible :)

Though I don't have all that much experience with mountable ones yet.. as 3.1 is still new and I don't really have any bread-n-butter projects in my day job that could use the functionality.

#31 Updated by Felix Schäfer almost 3 years ago

David Bennett wrote:

Felix Schäfer wrote:

David, do you have experience with the 3.1 full engines?

If by full engines you mean ones with there own logic/models/controllers/migrations that can be added by just adding something to your Gemfile.

Then yes, I use them where ever possible :)

Though I don't have all that much experience with mountable ones yet.. as 3.1 is still new and I don't really have any bread-n-butter projects in my day job that could use the functionality.

No, that's full engines vs. mountable apps. Mountable apps are self-contained and referenced only in the parent routes.rb to tell which "top-level" URI the mountable app has. Full engines are "nearer" to the 2.3 engines in that they are loaded with the main app, have access to all the same models, controllers, and everything (mountable apps are fully segregated). Both types are/can be packaged as gems though.

#34 Updated by Toshi MARUYAMA almost 3 years ago

  • % Done changed from 40 to 50

I rebased on r8089.

Git: Mercurial:

Changes

  • rename css to css.erb
  • use asset_path instead of hard-coded path
diff --git a/app/assets/stylesheets/scm.css.erb b/app/assets/stylesheets/scm.css.erb
--- a/app/assets/stylesheets/scm.css.erb
+++ b/app/assets/stylesheets/scm.css.erb
@@ -9,7 +9,7 @@

 li.change {
     list-style-type:none;
-    background-image: url(../images/bullet_black.png);
+    background-image: url(<%= asset_path "bullet_black.png" %>); 
     background-position: 1px 1px;
     background-repeat: no-repeat;
     padding-top: 1px;

Revisions are from following repository.

#38 Updated by John Yani almost 3 years ago

Rails 3.2.0 is out

Is there any work break down structure of work required to complete porting Redmine to Rails 3? Are there any routine tasks that unexperienced programmer could help with?

#40 Updated by Sridhar P over 2 years ago

I would like to work on this. I am thinking in the lines of forking on github and submitting pull requests whenever I have completed a significant task. Talking of tasks, is there any list of issues/to-do's that I can work on?

#41 Updated by John Yani over 2 years ago

Sridhar P wrote:

I would like to work on this. I am thinking in the lines of forking on github and submitting pull requests whenever I have completed a significant task. Talking of tasks, is there any list of issues/to-do's that I can work on?

I think you can start with cloning and setting up test environment to see what doesn't work. Then if you manually tested all features and everything seems to work, you can run redmine tests and see if there are any failures. I there are no any, you're done.

Then you can think of how to enable users to use Redmine with both Rails 2 and Rails 3. As of now the work is done/coordinated by Toshi. Seems like every week he rebases his work on the latest revision from svn trunk. AFAIK, there are no any todo lists. But you can look into git/hg log. There are many commits marked as "TODO", so you can review these patches to see what's wrong with them.

#42 Updated by Jean-Philippe Lang over 2 years ago

I have a working copy that runs and passes the full tests suite with Rails 3.1. There's some work to be done in order to provide the current features for Redmine plugins (migrations, view overriding, assets...) but still, most plugins won't be compatible out of the box. And honestly, I'm a bit disappointed with the performance. Redmine is 1.5x to 2x slower than with Rails 2.3. With ruby 1.9.3, it barely runs as fast as current trunk with Rails 2.3 + ruby 1.8.7.

Then you can think of how to enable users to use Redmine with both Rails 2 and Rails 3.

That's not really an option. There are too many changes in Rails 3 to support both versions with the same code base.

#43 Updated by Jean-Philippe Lang over 2 years ago

Here are the results of my quick performance tests (Rails 2.3 vs. Rails 3.2):

#44 Updated by Toshi MARUYAMA over 2 years ago

Jean-Philippe Lang wrote:

I have a working copy that runs and passes the full tests suite with Rails 3.1.

Could you create branch and commit to it such as source:sandbox/rails-2.3 ?

#45 Updated by John Yani over 2 years ago

Did anybody find out how to get wiki working? I've got an error:

can't write unknown attribute `versioned_type'
activerecord (3.2.1) lib/active_record/attribute_methods/write.rb:34:in `write_attribute'
activerecord (3.2.1) lib/active_record/attribute_methods/dirty.rb:67:in `write_attribute'
activerecord (3.2.1) lib/active_record/attribute_methods.rb:31:in `[]='
vendor/plugins/acts_as_versioned/lib/acts_as_versioned.rb:383:in `clone_versioned_model'
vendor/plugins/acts_as_versioned/lib/acts_as_versioned.rb:303:in `save_version_on_create'
app/controllers/wiki_controller.rb:154:in `update'

the problem is in the following line:

vendor/plugins/acts_as_versioned/lib/acts_as_versioned.rb
194: self.versioned_inheritance_column = options[:inheritance_column] || "versioned_#{inheritance_column}"

Somehow versioned_type column is missing.

#46 Updated by John Yani over 2 years ago

Update:

Seems like it is because Redmine doesn't use rake tasks provided by acts_as_versioned: create_versioned_table and drop_versioned_table

So, I should add migration field for versioned_type myself

#47 Updated by John Yani over 2 years ago

Here is a patch to enable wiki editing in Rails 3.2.1 https://github.com/marutosi/redmine/pull/6

#48 Updated by Jean-Philippe Lang over 2 years ago

  • Target version changed from Candidate for next major release to 2.0.0

#49 Updated by Terence Mill over 2 years ago

Can u explain ur results? For the first look rails 2.3 and ruby 1.9.3 performns best, and not the newest stack with rails 3.

Jean-Philippe Lang wrote:

Here are the results of my quick performance tests (Rails 2.3 vs. Rails 3.2):

#50 Updated by Jean-Philippe Lang over 2 years ago

Terence Mill wrote:

Can u explain ur results? For the first look rails 2.3 and ruby 1.9.3 performns best, and not the newest stack with rails 3.

Indeed, Rails 2.3 performs best as mentionned above. The graph shows the average response times in seconds for a few actions (assets are not involved here). Not much more to explain...

#51 Updated by John Yani over 2 years ago

Terence Mill wrote:

Can u explain ur results? For the first look rails 2.3 and ruby 1.9.3 performns best, and not the newest stack with rails 3.

Here is the detailed explanation:
http://bibwild.wordpress.com/2011/07/12/more-thoughts-on-unbearably-slow-rails3/
Shortly, it is because of extra ruby garbage collection, caused by increased size of the call stack in Rails 3.

#52 Updated by Alex Shulgin over 2 years ago

Hello good sirs.

Any chance of getting this done finally, especially in light of this (rails 2.3 no longer receives security updates from the core team): https://groups.google.com/d/msg/rubyonrails-talk/ZzL90ec7iAQ/368GA-TeQ6AJ ?

--
Regards,
Alex

#53 Updated by Jean-Philippe Lang over 2 years ago

The upgrade to Rails 3.0 is planned for Redmine 2.0 that should be the next major release.

#54 Updated by Terence Mill over 2 years ago

Really waiting for this Release, especially Prototype.js has been replaced with jQuery for ajax calls.

#55 Updated by Toshi MARUYAMA over 2 years ago

Terence Mill wrote:

Really waiting for this Release, especially Prototype.js has been replaced with jQuery for ajax calls.

"prototype-rails" and "prototype_legacy_helper" provide compatibility.

#56 Updated by Etienne Massip over 2 years ago

Terence Mill wrote:

Really waiting for this Release, especially Prototype.js has been replaced with jQuery for ajax calls.

What difference does this make?

#57 Updated by Onno van der Straaten over 2 years ago

Etienne Massip wrote:

Terence Mill wrote:

Really waiting for this Release, especially Prototype.js has been replaced with jQuery for ajax calls.

What difference does this make?

This is also one of the things I would like to see in Redmine 2.0. Upgrading to Rails 3 however does not imply that Redmine 2.0 will use JQuery. I personally doubt that this effort is also about migrating to JQuery.

If you are using Redmine as is it doesn't matter what framework is being used. But if you want to extend Redmine, it does. So for example I added functionality which uses a JQuery Slides (http://slidesjs.com/). Now my 'extended' Redmine installation uses JQuery and not Prototype for some pages. Using Prototype and JQuery in one website is of course not so nice but necessary because JQuery has a lot more to offer.

#58 Updated by Etienne Massip over 2 years ago

Onno van der Straaten wrote:

Using Prototype and JQuery in one website is of course not so nice but necessary because JQuery has a lot more to offer.

Whatever, Redmine has not Javascript API, jQuery and Prototype can coexist very well and I can't see why using 2 tooling frameworks would be bad.

#59 Updated by Terence Mill over 2 years ago

Hmm i hoped we will get rid of prototype because we wanna integrate our SSo Solution for redmine (which is based on CAS) and the problem with redirect on ajax request direct after an revelidation attempt of the SSO gatway (a java servlet filter in front of web.xml war of a jruby redmine tomcat installation), this redirect of an XMLHttpRequest (fired by prototyp.js i think) is not understood by the browser. This leads to "nothing happening" in the application as long a non ajax request is triggered by the request caused by user click.
Our SSO Gateway in front of the redmine can understand jquery ajax requests and wraps them so that the redirect in the browser works. This does not work for prototype js.

There is no documentation where and how often ajax is used in redmine forms, else we could think about moving this urls by filter out of the sso secure area and workawound the problem.

Etienne Massip wrote:

Terence Mill wrote:

Really waiting for this Release, especially Prototype.js has been replaced with jQuery for ajax calls.

What difference does this make?

#60 Updated by Etienne Massip over 2 years ago

Terence Mill wrote:

Our SSO Gateway in front of the redmine can understand jquery ajax requests and wraps them so that the redirect in the browser works. This does not work for prototype js.

What is done with jQuery making the Ajax request understood that you can't do with Prototype?

#61 Updated by Jean-Philippe Lang over 2 years ago

  • Status changed from New to Closed
  • Assignee set to Jean-Philippe Lang
  • % Done changed from 70 to 100
  • Resolution set to Fixed

Please open a new ticket for any issue related to Rails3 support.

Also available in: Atom PDF