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
| apps | |
| shared | |
| app | |
| assets | |
| controllers | |
| shared | |
| controller | |
| authentication.rb | |
| models | |
| shared |
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
| apps | |
| shared | |
| app | |
| assets | |
| controllers | |
| shared | |
| authentication.rb | |
| models | |
| shared | |
| post.rb |
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
| app | |
| models | |
| user.rb | |
| post.rb | |
| config | |
| db | |
| migrate | |
| engines | |
| customer | |
| app |
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
| app | |
| assets | |
| controllers | |
| models | |
| user.rb | |
| post.rb | |
| views | |
| layouts | |
| admin | |
| app |
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
| # initializer | |
| ResqueBus.dispatch("profile") do | |
| subscribe "rating_created" do |attributes| | |
| rating = Rating.find(rating_id) | |
| total = Rating.where(rabbit_id: rating.rabbit_id).count | |
| sum = Rating.where(rabbit_id: rating.rabbit_id').sum(:value) | |
| profile = RabbitProfile.find_by(user_id: rating.rabbit_id) | |
| profile.ratings_total = total | |
| profile.rating_average = sum.to_f / (5*total.to_f) |
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 CalculateAverageWorker | |
| @queue = :default | |
| def self.perform(rating_id) | |
| rating = Rating.find(rating_id) | |
| total = Rating.where(rabbit_id: rating.rabbit_id).count | |
| sum = Rating.where(rabbit_id: rating.rabbit_id').sum(:value) | |
| profile = RabbitProfile.find_by(user_id: rating.rabbit_id) | |
| profile.ratings_total = total |
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
| config.before(:suite) do | |
| Offshore.suite.start(:host => "localhost", :port => 4111) | |
| end | |
| config.before(:each) do | |
| Offshore.test.start(example) | |
| end | |
| config.after(:each) do | |
| Offshore.test.stop |
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
| group :test do | |
| gem 'offshore' | |
| 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
| namespace :offshore do | |
| task :preload do | |
| ENV['RAILS_ENV'] = "test" | |
| end | |
| task :setup => :environment | |
| desc "seeds the db for offshore gem" | |
| task :seed do | |
| Rake::Task['db:migrate'].invoke | |
| Rake::Task['db:test:prepare'].invoke |
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
| Offshore.redis = "localhost:6379" | |
| Offshore.enable! if ENV['OFFSHORE'] == 'true' |