Displaying 2 results from an estimated 2 matches for "song_titl".
Did you mean:
song_title
2010 Sep 24
4
invalid argument for file creating
hi
I use song_title to creat a file named by song_title.I have many song
titles to create many files.but unfortunately,some of song titles
contain special characters,such as [ ,which leads the following error:
#####
Errno::EINVAL in Lyric spiderController#scrap_one_category
Invalid argument - e:/rails/lyric/public/so...
2006 Jul 21
1
Passing a variable between methods
...would I do this?
Model:
class Advert < ActiveRecord::Base
belongs_to :user
def self.search(query)
if !query.to_s.strip.empty?
tokens = query.split.collect {|c| "%#{c.downcase}%"}
find_by_sql(["select s.* from songs s where #{
(["(lower(s.song_title) like ? or lower(s.song_lyrics) like ?)"] *
tokens.size).join(" and ") } order by s.created_on desc", *(tokens *
2).sort])
else
[]
end
end
end
Controller:
def search
@query = @params["query"]
@adverts = Advert.search(@query)
e...