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 randomize_photo_file_name | |
| extension = File.extname(photo_file_name) | |
| self.photo.instance_write(:file_name, "#{ActiveSupport::SecureRandom.hex.first(16)}#{extension}") | |
| 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
| has_attached_file :photo, :styles => { :medium => "300x300>", :thumb => "100x100>" }, | |
| :url => "/assets/attachments/:id/:style/:basename.:extension", | |
| :path => ":rails_root/public/assets/attachments/:id/:style/:basename.:extension" | |
| before_post_process :randomize_photo_file_name |
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
| class Array | |
| def remove(*args) | |
| string_params = "" | |
| args.each do |arg_item| | |
| string_params += arg_item | |
| end | |
| flatten.collect { |k| k.delete string_params} | |
| end | |
| def repeat(int) |
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 show | |
| prawnto :prawn => { :page_size => 'A4', | |
| :left_margin => 40, | |
| :right_margin => 30, | |
| :top_margin => 40, | |
| :bottom_margin => 30}, | |
| :filename => "invoice_{@transaction.id}_customer_{@transaction.customer_id}.pdf" | |
| render :layout => false | |
| 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
| <%= link_to "Generate PDF", transaction_url(transaction.id, :format => "pdf") %> |
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 run cmd, params = "", expected_outcodes = 0 | |
| command = %Q[#{path_for_command(cmd)} #{params}].gsub(/\s+/, " ") | |
| command = "#{command} 2>#{bit_bucket}" if Paperclip.options[:swallow_stderr] | |
| Paperclip.log(command) if Paperclip.options[:log_command] | |
| output = `#{command}` | |
| unless [expected_outcodes].flatten.include?($?.exitstatus) | |
| raise PaperclipCommandLineError, "Error while running #{cmd}" | |
| end | |
| output | |
| 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
| def run cmd, params = "", expected_outcodes = 0 | |
| command = %Q[#{path_for_command(cmd)} #{params}] # remove this => .gsub(/\s+/, " ") | |
| command = "#{command} 2>#{bit_bucket}" if Paperclip.options[:swallow_stderr] | |
| Paperclip.log(command) if Paperclip.options[:log_command] | |
| output = `#{command}` | |
| unless [expected_outcodes].flatten.include?($?.exitstatus) | |
| raise PaperclipCommandLineError, "Error while running #{cmd}" | |
| end | |
| output | |
| 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
| rails directory --skip-activerecord | |
| /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0.beta3/lib/rails/generators.rb:6:in `require': no such file to load -- active_support/core_ext/kernel/singleton_class (LoadError) | |
| from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0.beta3/lib/rails/generators.rb:6:in `<top (required)>' | |
| from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0.beta3/lib/rails/commands/application.rb:10:in `require' | |
| from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0.beta3/lib/rails/commands/application.rb:10:in `<top (required)>' | |
| from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0.beta3/lib/rails/cli.rb:30:in `require' | |
| from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0.beta3/lib/rails/cli.rb:30:in `<top (required)>' | |
| from /usr/local/lib/ruby/gems/1.9.1/gems/rails-3.0.0.beta3/bin/rails:1:in `require' | |
| from /usr/local/lib/ruby/gems/1.9.1/gems/rails-3.0.0.beta3/bin/rails:1:in `<top (required)>' | |
| from /usr/local/bin/rails:19:in `load' |
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
| sudo env ARCHFLAGS="-arch x86_64" gem install pg |
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
| sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config |
OlderNewer