Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module ApplicationHelper
- # would like to do something like this:
- # delegate :format_text, to: self.format_text
- # all this method does is call self.format_text
- def format_text(text)
- # calls the class level method
- format_text(text)
- end
- # need the self. in front to use outside of view
- def self.format_text(text)
- # do something to the text and return a string
- end
- end
- %label= format_text('something needs formatting')
- def header_of_some_data
- "#{@name} blah #{ApplicationHelper.format_text('some text')}"
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement