Forum: Ruby on Rails How to Call function

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
3083ca8f0496edaac2fa10c20630d0bc?d=identicon&s=25 Newb Newb (newb)
on 2009-02-27 06:21
if sub.include?("html")
   path = File.join("/ACMServer_exe/ChatHistory",f,sub_folder_name,sub)
   @file_path << path
   @found_folder << sub_folder_name
   @chat_date << f
end

The above code has to be used in my controller repeatively in the same
function.
like below
if something
  if sub.include?("html")
   path = File.join("/ACMServer_exe/ChatHistory",f,sub_folder_name,sub)
   @file_path << path
   @found_folder << sub_folder_name
   @chat_date << f
   end
elsif
   if sub.include?("html")
   path = File.join("/ACMServer_exe/ChatHistory",f,sub_folder_name,sub)
   @file_path << path
   @found_folder << sub_folder_name
   @chat_date << f
   end
else
   if sub.include?("html")
   path = File.join("/ACMServer_exe/ChatHistory",f,sub_folder_name,sub)
   @file_path << path
   @found_folder << sub_folder_name
   @chat_date << f
   end
end


Because Parameter will be changing.
i want to reduce my legth of code.
pls help how to make those code into function.
and how can i call that function in to my controller.
i dont have any idea how that function can return the output to my
controoler function .


 Kinldy help me to learn .
 Thanks
This topic is locked and can not be replied to.