I’m unable to pass a subset of a form’s parameters to another method
within the same controller. The error message is “wrong number of
arguments (0 for 3)” and there aren’t any parameters listed.
Here’s the controller code:
class InfoController < ApplicationController
def show_actual_forecast_data
# parameters from the form
data_type = params[:datatype]
productnbr = params[:productlinenbr]
start_date = params[:start_date]
end_date = params[:end_date]
detail_or_sum = params[:detail_sum]
@time_search = TimePeriodSearch.new(data_type, productnbr,
start_date, end_date, dtail_or_sum)
if detail_or_sum == "detail" then
if dtype == "actual" then
redirect_to({:action => 'test_page'}, :datatype => data_type,
:start_date => start_date,
:end_date => end_date)
end
end
end
def test_page(datatype, start_date, end_date)
@actual_data = Dailytotal.actual_data_sum(datatype, start_date,
end_date)
end
end
Here’s the TimePeriodSearch model:
class TimePeriodSearch
attr_accessor :datatype, :productnbr, :start_date, :end_date,
:detail_or_sum
def initialize(datatype, productnbr, start_date, end_date,
detail_or_sum)
@datatype, @productnbr = datatype, productnbr
@start_date, @end_date = start_date, end_date
@detail_or_sum = detail_or_sum
end
end
Any feedback would be greatly appreciated.