This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
En el application_controller.rb: | |
def render_to_fancybox(options) | |
html = render_to_string(options).to_json | |
render :update do |page| | |
page << "$.fancybox(#{html});" | |
end | |
end | |
En cualquier controlador: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.print_hash(hash, level) | |
hash.each do |k,v| | |
text = "#{"--"*level} #{k} (#{v.class})" | |
if v.is_a?(Hash) | |
p text | |
print_hash(v, (level+1)) | |
else | |
p "#{text} => #{v}" | |
end | |
end |