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
| ProductType.all.each do |product_type| | |
| # Check if product type has banyan category group | |
| product_type_group = product_type.category_group | |
| # Create banyan category group for product type if not exist | |
| if product_type_group.nil? | |
| product_type_group = Banyan::CategoryGroup.new(:name => product_type.name + " Category Group") | |
| product_type_group.group_categorizable = product_type | |
| product_type_group.save! | |
| 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
| --- | |
| :domain: "yourdomain.com" | |
| :perform_deliveries: true | |
| :address: 'relay.smtpserver.com' | |
| :port: | |
| :user_name: | |
| :password: | |
| :authentication: :plain | |
| :enable_starttls_auto: true |
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
| Resque.after_fork do |job| | |
| jobs_performed = 0 | |
| kill_fork_at = Time.now.to_i + (ENV['MINUTES_PER_FORK'].to_i * 60) | |
| worker = job.worker | |
| first_job = job | |
| worker.procline "Processing #{job.queue} since #{Time.now.to_i} until #{kill_fork_at}" | |
| first_job.perform | |
| # rely on parent error handling |
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
| This is a brief description of how to get VestalVersions and Paperclip to play nicely. | |
| The paperclip_initializer.rb extends paperclip for a new option :keep_old_files which means that paperclip won't remove the file when a new file is uploaded. In order for this to work, the model also needs to have to have specific settings: | |
| #1. The version needs to be included in the file path | |
| #2. A method to get the actual path to the file. (The file may not be at the current version) | |
| You can view both these settings in the model_files.rb file below. | |
| Note: If you dealing with public files then you will need to include the :id_and_version option in the :url and :path. Then in the view you need to reference the model_file.versioned_file_path. |
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 User < ActiveRecord::Base | |
| has_many :cars | |
| end | |
| class Car < ActiveRecord::Base | |
| belongs_to :user, :counter_cache => true | |
| end |
NewerOlder