Advertisement
Guest User

Untitled

a guest
Oct 20th, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. module ApplicationHelper
  2.  
  3. # would like to do something like this:
  4. # delegate :format_text, to: self.format_text
  5.  
  6. # all this method does is call self.format_text
  7. def format_text(text)
  8. # calls the class level method
  9. format_text(text)
  10. end
  11.  
  12. # need the self. in front to use outside of view
  13. def self.format_text(text)
  14. # do something to the text and return a string
  15. end
  16. end
  17.  
  18. %label= format_text('something needs formatting')
  19.  
  20. def header_of_some_data
  21. "#{@name} blah #{ApplicationHelper.format_text('some text')}"
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement