I would like to define a method that takes one of DB fields as an input
and returns a portion of it.
A table 'Project' has a field URL. I need to output a portion of the
Say, I have a YouTube URL, and the output must be only 'WXYZ'
so I have tried to define an action in 'projects_controller.rb',
def video_code url
def getVideoCode url
re = Regexp.new('http:\/\/www.youtube.com\/watch\?v=(.*)')
m = re.match(url)
<%= project.video_code(project.url) %>
gives an error,
undefined method `video_code' for #<ProjectsController:0x000001035f64d8>
I think the way I defined the action (or method) is wrong.
Could anyone help me for this?
Thanks in advance.