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.
Posted via http://www.ruby-forum.com/.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to email@example.com.
To unsubscribe from this group, send email to firstname.lastname@example.org.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.