Project

General

Profile

Feature #7230

Upgrade Ruby on Rails to 4.1

Added by Dominic Cleal about 5 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Category:
Rails
Target version:

Description

This ticket tracks the upgrade of core Foreman to Ruby on Rails 4.0 from 3.2.


Related issues

Related to Foreman - Bug #10019: Compute Profile Memory options different for selected language?Closed2015-04-03
Related to Foreman - Bug #4274: remove I18n deprecation warning when running testsResolved2014-02-06
Related to Packaging - Bug #12876: Foreman build can't find bundler 1.3 or higher on Wheezy/PreciseClosed2015-12-18
Related to Foreman - Bug #12891: search_by_params for host returns all hostsClosed2015-12-21
Related to Foreman - Refactor #12892: move rails binaries to /bin directoryClosed2015-12-21
Related to Foreman - Bug #8055: missing stylesheets in apidocClosed2014-10-23
Related to Foreman - Bug #12977: sprockets-rails 2.2.2 or higher is needed for production assets setupClosed2016-01-04
Related to Foreman - Bug #13005: Plugin CSS assets are not minified during precompilationClosed2016-01-05
Related to Foreman - Bug #13033: plugin:gettext rake task doesn't load with gettext_i18n_rails_js 1.xClosed2016-01-07
Related to Foreman - Bug #13131: plugin skip tests not working after rails 4 migrationClosed2016-01-12
Related to Foreman - Refactor #13409: Remove maintain_test_schema! Rails initializerClosed2016-01-27
Related to Foreman - Refactor #14022: secret_key_base should be configuredDuplicate2016-03-02
Related to Foreman - Bug #14028: Routing errors due to missing graphics/fonts on navigating smart-proxy pageClosed2016-03-02
Blocks Foreman - Tracker #3157: Rails 4.1 upgrade tasksClosed2013-09-27

Blocks Foreman - Refactor #12485: Consider replacing Rails counter_cache with counter_culture gemRejected2015-11-15
Blocks Foreman - Feature #12873: Update Rails to 4.1.latestClosed2015-12-18
Blocks Foreman - Bug #7246: Remove counter workaround for #5692 on upgrade to rails 4.xRejected2014-08-25
Blocks Foreman - Bug #12219: Test failures on Ruby 2.2Closed2015-10-20

Associated revisions

Revision c80f3b10 (diff)
Added by Tom Caspy almost 4 years ago

fixes #7230 - rails 4 compatibility

Revision fb9f45e8 (diff)
Added by Daniel Lobato Garcia almost 4 years ago

Fixes #7230, #12021 - Upgrade to Rails 4.1.5

This commits upgrades Rails to Rails 4.1.5. See a description of the
changes included here, and go to the pull request in GitHub to see more
detailed explanations:

  • Update gems to a Rails 4 compatible version, including dependencies
  • Fix counter cache columns
  • Remove conditions, order, limit from has_many relations
  • Remove test runner
    On minitest 5, the runner API was deprecated, so our custom test
    runner is no longer working.
  • Remove useless add_index on lookup_values match
    An index is added previously on lookup_values :priority, and on Rails 4
    rename_column changes 'priority' to 'match' already changes the name of
    the index.
  • Alias assert_include to assert_includes.
  • Expire topbar cache
  • Subclass ApplicationMailer in test to avoid 'missing template' error
  • Fixes #12021 - Use .to_param to find parent object in LookupKeys controller
    On Rails 4, .find will not default to .friendly.find so find_hostgroup,
    find_environment and find_host will fail for non numeric IDs. However, we can
    use from_param to find these objects. This is something we can do both on
    Rails 3 and Rails 4, whereas using .friendly isn't an option until friendly_id
    5.0, which depends on Rails 4.
  • Use explicit friendly ID search.
  • find_common finder uses from_param -> friendly -> find
    The finder needed to be refactored because with the new Friendly ID we
    have to use .friendly explicitely. It currently follows the strategy of
    searching like this:
    - from_param -> .friendly -> regular find
  • Remove RecordNotFound errors from parameterizable in rails 4
  • Protect attributes using attr_accessible and protected_attributes
  • url_for doesn't append port when protocol is specified
    Some of our tests are checking if port 80 or 443 is included in the URL
    generated by lib/foreman/renderer.rb. However url_for has changed in
    Rails 4 and now it does not append the port even if explicitly added.

    If the protocol is specified, as it is in this case, then the url
    generated will just have the protocol (http or https) but not the port
    (80 or 443)

  • Validate object instead of _id column in join tables
    On Rails 4 such validations will fail when we try to create objects
    without explicitely assigning the id.
    Puppetclass.new(:config_group => config_group) would fail even for a
    valid config group, :config_group_id => config_group.id should be used
    instead.

    To avoid that, we validate the object, not the ID column

  • Rails 4 non backwards compatible syntax changes
    Changes that have to deal with how some of the internal Rails objects
    need a new syntax, like generating routes, exceptions, form builders.
    None of these are Rails 3 compatible.
  • Refactor fact value test to not modify user_roles directly
  • Return external usergroupsas an array
  • Use eager_load to preload associations to be used in where

Fixes #7230, #12021 - Upgrade to Rails 4.1.5

This commits upgrades Rails to Rails 4.1.5. See a description of the
changes included here, and go to the pull request in GitHub to see more
detailed explanations:

  • Update gems to a Rails 4 compatible version, including dependencies
  • Fix counter cache columns
  • Remove conditions, order, limit from has_many relations
  • Remove test runner
    On minitest 5, the runner API was deprecated, so our custom test
    runner is no longer working.
  • Remove useless add_index on lookup_values match
    An index is added previously on lookup_values :priority, and on Rails 4
    rename_column changes 'priority' to 'match' already changes the name of
    the index.
  • Alias assert_include to assert_includes.
  • Expire topbar cache
  • Subclass ApplicationMailer in test to avoid 'missing template' error
  • Fixes #12021 - Use .to_param to find parent object in LookupKeys controller
    On Rails 4, .find will not default to .friendly.find so find_hostgroup,
    find_environment and find_host will fail for non numeric IDs. However, we can
    use from_param to find these objects. This is something we can do both on
    Rails 3 and Rails 4, whereas using .friendly isn't an option until friendly_id
    5.0, which depends on Rails 4.
  • Use explicit friendly ID search.
  • find_common finder uses from_param -> friendly -> find
    The finder needed to be refactored because with the new Friendly ID we
    have to use .friendly explicitely. It currently follows the strategy of
    searching like this:
    - from_param -> .friendly -> regular find
  • Remove RecordNotFound errors from parameterizable in rails 4
  • Protect attributes using attr_accessible and protected_attributes
  • url_for doesn't append port when protocol is specified
    Some of our tests are checking if port 80 or 443 is included in the URL
    generated by lib/foreman/renderer.rb. However url_for has changed in
    Rails 4 and now it does not append the port even if explicitly added.

    If the protocol is specified, as it is in this case, then the url
    generated will just have the protocol (http or https) but not the port
    (80 or 443)

  • Validate object instead of _id column in join tables
    On Rails 4 such validations will fail when we try to create objects
    without explicitely assigning the id.
    Puppetclass.new(:config_group => config_group) would fail even for a
    valid config group, :config_group_id => config_group.id should be used
    instead.

    To avoid that, we validate the object, not the ID column

  • Rails 4 non backwards compatible syntax changes
    Changes that have to deal with how some of the internal Rails objects
    need a new syntax, like generating routes, exceptions, form builders.
    None of these are Rails 3 compatible.
  • Refactor fact value test to not modify user_roles directly
  • Return external usergroupsas an array
  • Use eager_load to preload associations to be used in where
  • Auto detect jenkins rake task in application.rb and set test RAILS_ENV
    in that case
  • Reference previously undigested assets in CSS and js as digested using
    asset-url or image-url
  • Adapted sprockets manifest.json instead of manifest.yml (ehelms)

Revision 9df4a434 (diff)
Added by Dominic Cleal almost 4 years ago

refs #7230 - update Foreman dependencies

History

#1 Updated by Dominic Cleal about 5 years ago

#2 Updated by Ohad Levy about 5 years ago

  • Legacy Backlogs Release (now unused) set to 21

#3 Updated by Ohad Levy about 5 years ago

  • Legacy Backlogs Release (now unused) deleted (21)

#4 Updated by Tom Caspy almost 5 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Tom Caspy

upgraded the gemfile on https://github.com/unorthodoxgeek/foreman/tree/rails4 - rails currently boots up. creating new tickets for fixing multiple issues which popped up once that was done.

#5 Updated by The Foreman Bot about 4 years ago

  • Pull request https://github.com/theforeman/foreman/pull/2870 added
  • Pull request deleted ()

#6 Updated by The Foreman Bot about 4 years ago

  • Assignee deleted (Tom Caspy)

#7 Updated by The Foreman Bot about 4 years ago

  • Assignee set to Tom Caspy

#8 Updated by Tomer Brisker about 4 years ago

  • Blocks Refactor #12485: Consider replacing Rails counter_cache with counter_culture gem added

#9 Updated by The Foreman Bot almost 4 years ago

  • Pull request https://github.com/theforeman/foreman-docker/pull/126 added

#10 Updated by Anonymous almost 4 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#11 Updated by Dominic Cleal almost 4 years ago

  • Status changed from Closed to Ready For Testing
  • % Done changed from 100 to 0

This has not been merged to Foreman, a plugin commit erroneously "fixed" this ticket number.

#12 Updated by Dominic Cleal almost 4 years ago

  • Subject changed from Upgrade Ruby on Rails to 4.0 to Upgrade Ruby on Rails to 4.1
  • Assignee changed from Tom Caspy to Daniel Lobato Garcia
  • Legacy Backlogs Release (now unused) set to 71

#13 Updated by Dominic Cleal almost 4 years ago

  • Has duplicate Bug #4274: remove I18n deprecation warning when running tests added

#14 Updated by Dominic Cleal almost 4 years ago

  • Has duplicate deleted (Bug #4274: remove I18n deprecation warning when running tests)

#15 Updated by Dominic Cleal almost 4 years ago

  • Has duplicate Bug #4274: remove I18n deprecation warning when running tests added

#16 Updated by Dominic Cleal almost 4 years ago

  • Related to Bug #10019: Compute Profile Memory options different for selected language? added

#17 Updated by Dominic Cleal almost 4 years ago

#18 Updated by Dominic Cleal almost 4 years ago

  • Blocks Bug #7246: Remove counter workaround for #5692 on upgrade to rails 4.x added

#19 Updated by Dominic Cleal almost 4 years ago

  • Has duplicate deleted (Bug #4274: remove I18n deprecation warning when running tests)

#20 Updated by Dominic Cleal almost 4 years ago

  • Related to Bug #4274: remove I18n deprecation warning when running tests added

#21 Updated by Daniel Lobato Garcia almost 4 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#22 Updated by Dominic Cleal almost 4 years ago

  • Related to Bug #12876: Foreman build can't find bundler 1.3 or higher on Wheezy/Precise added

#23 Updated by Ori Rabin almost 4 years ago

  • Related to Bug #12891: search_by_params for host returns all hosts added

#24 Updated by Ohad Levy almost 4 years ago

#25 Updated by Dominic Cleal almost 4 years ago

  • Related to Bug #8055: missing stylesheets in apidoc added

#26 Updated by Dominic Cleal almost 4 years ago

  • Blocks Bug #12219: Test failures on Ruby 2.2 added

#27 Updated by Dominic Cleal almost 4 years ago

  • Related to Bug #12977: sprockets-rails 2.2.2 or higher is needed for production assets setup added

#28 Updated by Dominic Cleal almost 4 years ago

  • Related to Bug #13005: Plugin CSS assets are not minified during precompilation added

#29 Updated by Dominic Cleal almost 4 years ago

  • Related to Bug #13033: plugin:gettext rake task doesn't load with gettext_i18n_rails_js 1.x added

#30 Updated by The Foreman Bot almost 4 years ago

  • Pull request https://github.com/theforeman/foreman_bootdisk/pull/18 added

#31 Updated by Dominic Cleal almost 4 years ago

  • Related to Bug #13131: plugin skip tests not working after rails 4 migration added

#32 Updated by Dominic Cleal almost 4 years ago

  • Related to Refactor #13409: Remove maintain_test_schema! Rails initializer added

#33 Updated by Dominic Cleal over 3 years ago

#34 Updated by Dominic Cleal over 3 years ago

  • Related to Bug #14028: Routing errors due to missing graphics/fonts on navigating smart-proxy page added

Also available in: Atom PDF