i want to use a custom notification helper to generate notifications (flash) messages in my Padrino app. Inside the helper i want to use the built-in Padrino helpers (flash and content_tag. (See example below)
class NotificationHelper
def self.notify
unless flash.empty?
content_tag :div, class: 'notifications' do
flash.map do |key, msg|
headline = case key
when :success then 'Super!'
when :error then 'Oh. Das tut uns leid.'
end
content_tag :p, :class => "notification" do
content_tag(:span, headline, class: "headline #{key}") + msg
end
end.join("\n")
end
end
end
end
But if i'm using the helper in my views, i got the following error: "NoMethodError - undefined method `content_tag' for NotificationHelper:Class:"
What did i wrong?