This file contains hidden or 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
| 1. Set the mysql bin path if you installed it by yourself in /usr/local/mysql | |
| #you have to set your mysql bin on your path: | |
| PATH=$PATH:/usr/local/mysql/bin | |
| 2. Remove the default mysql executable files | |
| $ sudo mv /usr/bin/mysql_config usr/bin/mysql_config.old | |
| $ sudo mv /usr/bin/mysql usr/bin/mysql |
This file contains hidden or 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
| install do-mysql | |
| Installing do_mysql-0.9.11 | |
| Building native extensions. This could take a while... | |
| ERROR: Failed to build gem native extension. | |
| /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb merb:gem:install | |
| checking for mysql.h... no | |
| checking for main() in -lmysqlclient... no | |
| checking for mysql_query()... no | |
| checking for mysql_ssl_set()... no |
This file contains hidden or 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
| # from dm-constraints/lib/dm-constraints/delete_constraint.rb | |
| when :destroy! | |
| if children | |
| # not sure why but this lazy_load is necessary | |
| # otherwise children will not be deleted with destroy! | |
| children.lazy_load | |
| children.destroy! | |
| end | |
| .... |
This file contains hidden or 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
| # from dm-constraints/lib/dm-constraints/delete_constraint.rb | |
| when :destroy! | |
| if children | |
| # not sure why but this lazy_load is necessary | |
| # otherwise children will not be deleted with destroy! | |
| children.lazy_load | |
| children.destroy! | |
| end | |
| .... |
This file contains hidden or 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
| #I am not sure if this is the feature(it is designed to do so), | |
| # or I'm doing it wrong. Here is the situation I have: | |
| # as of DM version: 0.9.9 | |
| class Order | |
| before :destroy, :destroy_items | |
| .... | |
| has n, items ... | |
| def destroy_items |
This file contains hidden or 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
| # price_letter.pdf.erb | |
| <%= | |
| require "prawn/measurement_extensions" | |
| require "prawn/table" | |
| pdf = Prawn::Document.new( | |
| :page_size => "A4", | |
| :left_margin => 2.cm, | |
| :right_margin => 2.cm, | |
| :top_margin => 2.cm, |
This file contains hidden or 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
| pdf = Prawn::Document.new( | |
| :page_size => "A4", | |
| :left_margin => 2.cm, | |
| :right_margin => 2.cm, | |
| :top_margin => 2.cm, | |
| :bottom_margin => 1.5.cm | |
| ) | |
| # logo | |
| logo = image_dir + 'logo.jpg' | |
| pdf.image logo, :position => :center |
This file contains hidden or 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 priceletter | |
| provides :pdf | |
| ... | |
| end |
This file contains hidden or 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
| <%= form_for(@price_letter, :action => resource(:ordering, @price_letter, :priceletter, :format => "pdf"), :class => "form") do %> | |
| # fields for .... | |
| <% end =%> |
This file contains hidden or 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
| Merb::BootLoader.after_app_loads do | |
| Merb.add_mime_type(:pdf, :to_pdf, %w[application/pdf], "Content-Encoding" => "gzip") | |
| end |