KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I defined a custom method in application_helper.rb file like the following: def rxtrnk(line) rxTRNK = /\w{9,12}/m trnks = Array.new i = 0 while i <= line.size if line[i].match(rxTRNK) trnks[i] = line[i].scan(rxTRNK) end i += 1 end return trnks end Then I tried to call it from a view like so: <% @yo = rxtrnk(@rts)%> But I get an error page like this: NoMethodError in TrunksController#routesperswitch undefined method `rxtrnk' for #<TrunksController:0x7f2dcf88> I know this is a very newbie question, but I couldn't find solution from googling :( Thanks for your help edit/ here is the full application_helper.rb module ApplicationHelper def rxtrnk(line) rxTRNK = /\w{9,12}/m trnks = Array.new i = 0 while i <= line.size if line[i].match(rxTRNK) trnks[i] = line[i].scan(rxTRNK) end i += 1 end return trnks end end
Tags (comma-separated)
Save Edits
Cancel