Fixes "ArgumentError: wrong number of arguments (given 0, expected 1) in ApplicationController#find_model_object" in Rails 8 (#43205, #43230).

Patch by Katsuya HIDAKA (user:hidakatsuya).


git-svn-id: https://svn.redmine.org/redmine/trunk@24017 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Marius Balteanu
2025-09-28 21:20:39 +00:00
parent e3015edd96
commit be07d4d01d
7 changed files with 12 additions and 10 deletions

View File

@@ -389,10 +389,6 @@ class ApplicationController < ActionController::Base
render_404 render_404
end end
def self.model_object(model)
self.model_object = model
end
# Find the issue whose id is the :id parameter # Find the issue whose id is the :id parameter
# Raises a Unauthorized exception if the issue is not visible # Raises a Unauthorized exception if the issue is not visible
def find_issue def find_issue

View File

@@ -18,8 +18,9 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class CommentsController < ApplicationController class CommentsController < ApplicationController
self.model_object = News
default_search_scope :news default_search_scope :news
model_object News
before_action :find_model_object before_action :find_model_object
before_action :find_project_from_association before_action :find_project_from_association
before_action :authorize before_action :authorize

View File

@@ -18,8 +18,9 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class DocumentsController < ApplicationController class DocumentsController < ApplicationController
self.model_object = Document
default_search_scope :documents default_search_scope :documents
model_object Document
before_action :find_project_by_project_id, :only => [:index, :new, :create] before_action :find_project_by_project_id, :only => [:index, :new, :create]
before_action :find_model_object, :except => [:index, :new, :create] before_action :find_model_object, :except => [:index, :new, :create]
before_action :find_project_from_association, :except => [:index, :new, :create] before_action :find_project_from_association, :except => [:index, :new, :create]

View File

@@ -18,8 +18,9 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class IssueCategoriesController < ApplicationController class IssueCategoriesController < ApplicationController
self.model_object = IssueCategory
menu_item :settings menu_item :settings
model_object IssueCategory
before_action :find_model_object, :except => [:index, :new, :create] before_action :find_model_object, :except => [:index, :new, :create]
before_action :find_project_from_association, :except => [:index, :new, :create] before_action :find_project_from_association, :except => [:index, :new, :create]
before_action :find_project_by_project_id, :only => [:index, :new, :create] before_action :find_project_by_project_id, :only => [:index, :new, :create]

View File

@@ -18,7 +18,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class MembersController < ApplicationController class MembersController < ApplicationController
model_object Member self.model_object = Member
before_action :find_model_object, :except => [:index, :new, :create, :autocomplete] before_action :find_model_object, :except => [:index, :new, :create, :autocomplete]
before_action :find_project_from_association, :except => [:index, :new, :create, :autocomplete] before_action :find_project_from_association, :except => [:index, :new, :create, :autocomplete]
before_action :find_project_by_project_id, :only => [:index, :new, :create, :autocomplete] before_action :find_project_by_project_id, :only => [:index, :new, :create, :autocomplete]

View File

@@ -18,8 +18,9 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class NewsController < ApplicationController class NewsController < ApplicationController
self.model_object = News
default_search_scope :news default_search_scope :news
model_object News
before_action :find_model_object, :except => [:new, :create, :index] before_action :find_model_object, :except => [:new, :create, :index]
before_action :find_project_from_association, :except => [:new, :create, :index] before_action :find_project_from_association, :except => [:new, :create, :index]
before_action :find_project_by_project_id, :only => :create before_action :find_project_by_project_id, :only => :create

View File

@@ -18,8 +18,9 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class VersionsController < ApplicationController class VersionsController < ApplicationController
self.model_object = Version
menu_item :roadmap menu_item :roadmap
model_object Version
before_action :find_model_object, :except => [:index, :new, :create, :close_completed] before_action :find_model_object, :except => [:index, :new, :create, :close_completed]
before_action :find_project_from_association, :except => [:index, :new, :create, :close_completed] before_action :find_project_from_association, :except => [:index, :new, :create, :close_completed]
before_action :find_project_by_project_id, :only => [:index, :new, :create, :close_completed] before_action :find_project_by_project_id, :only => [:index, :new, :create, :close_completed]