Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module ContentForHelpers
- def content_for?(name, options = {}, &block)
- has_content = (!instance_variable_get("@content_for_#{name}").strip.blank? rescue nil)
- should_process = options[:negate] ? !has_content : has_content
- if should_process && block_given?
- concat(capture(&block), block.binding)
- end
- return should_process
- end
- def no_content_for?(name,&block)
- content_for?(name, :negate => true, &block)
- end
- def get_content_for(name)
- instance_variable_get("@content_for_#{name}")
- end
- end
Add Comment
Please, Sign In to add comment