A controller method includes:
@organization = Organization.find(params[:description])
check_expiration_date(@organization)
if @organization.update_attributes(subscription: true,
actioncode: session[:actioncode_id],
subs_exp_date: expiration_date)
...
private
def check_expiration_date(org)
expiration_date = Time.zone.now + 366.days
end
On the development server this generates the error below, referring to the line subs_exp_date: expiration_date
:
undefined local variable or method `expiration_date' for #<OrganizationsController:0x007f36cd01d2a8>
Any ideas what might be causing this error? My idea was that check_expiration_date is executed first and thus sets the variable expiration_date.