Welcome to Working With Rails

 

Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
Undefined prefix error in truncate_html
2 Posts
Undefined prefix error in truncate_html

Hi, Am using fckeditor to formatting text

am using below code to truncate text while displying user side

1 def truncate_html(input, len = 30, extension = "")

2 def attrs_to_s(attrs)
3 return '' if attrs.empty?
4 attrs.to_a.map { |attr| %{#{attr[0]}="#{attr[1]}"} }.join(' ')
5 end

6 p = REXML::Parsers::PullParser.new(input)
7 tags = []
8 new_len = len
9 results = ''
10 while p.has_next? && new_len > 0
11 p_e = p.pull
12 case p_e.event_type
13 tags.push p_e[0]
14 results << ""
15 when :end_element
16 results << ""
17 when :text
18 results << p_e[0].first(new_len)
19 new_len -= p_e[0].length
20 else
21 results << "<!-- #{p_e.inspect} -->"
22 end
23 end

 tags.reverse.each do |tag|  
   results &lt;&lt; ""  
 end  
 results.to_s + (input.length > len ? extension : '')  

end

In view


Recetly i found the error is ActiveRecors:TempleteView error Undefined prefix o found

The above error specifying at Line11

Can anybody help this error raising and suggest solution

Person
Forum Rating: 50
Sign In To Rate Post

Hi, Can you tell how did you solved for same problem

Person
Forum Rating: 50
Sign In To Rate Post
2 Posts
Login to add your message