From d90351b82ce3f40fd2d03a0a0839c4ca140dc06c Mon Sep 17 00:00:00 2001 From: saurabhbhatia Date: Fri, 3 Jan 2014 09:44:46 +0800 Subject: [PATCH] Changed production settings for sendgrid --- Gemfile | 1 + config/environments/production.rb | 2 +- lib/orbit_tag/taggable.rb | 1 - .../back_end/bulletins_controller.rb | 32 ++----------------- .../announcement/app/models/bulletin.rb | 11 +++++++ 5 files changed, 15 insertions(+), 32 deletions(-) diff --git a/Gemfile b/Gemfile index 730cea7f..9fa7db05 100644 --- a/Gemfile +++ b/Gemfile @@ -93,6 +93,7 @@ group :test, :development do gem 'pry-debugger' gem 'debugger' gem 'faker' + gem 'puma' # gem "sunspot-rails-tester" gem 'database_cleaner' #Strategies for cleaning databases. Can be used to ensure a clean state for testing. gem "rspec", "~> 2.0" diff --git a/config/environments/production.rb b/config/environments/production.rb index 80990763..307b249d 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -71,7 +71,7 @@ Orbit::Application.configure do :domain => "new.tp.rulingcom.com", :authentication => "plain", :user_name => "rulingcom", - :password => "rulingbjo4xjp6" + :password => "bjo4xjp6" } end diff --git a/lib/orbit_tag/taggable.rb b/lib/orbit_tag/taggable.rb index 0faf81b2..6a81c5dc 100644 --- a/lib/orbit_tag/taggable.rb +++ b/lib/orbit_tag/taggable.rb @@ -15,7 +15,6 @@ module OrbitTag has_many :taggings, as: :taggable, autosave: true, dependent: :destroy accepts_nested_attributes_for :taggings, allow_destroy: true - # after_save :remove_taggings, unless: Proc.new{self.tags_to_destroy.blank?} end send :include, InstanceMethods end diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb index 4a4416b1..4a22a813 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb @@ -120,40 +120,12 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController # PUT /bulletins/1.xml def update - @bulletin = Bulletin.find(params[:id]) - # @bulletin.image.clear if params[:bulletin][:image_del] == '1' - # if params[:bulletin][:image_del] == '1' - # @bulletin.remove_image! - # @bulletin.image_del = nil - # params[:bulletin][:image_del] = nil - # end - delete_out_invalid_date_from_params respond_to do |format| - if @bulletin.update_attributes(params[:bulletin]) - tag = [] - length = (@bulletin.tag_ids.length / 2) - @bulletin.tag_ids.each do |t| - tag << t.to_s - end - @bulletin.set(:tagged_ids, tag.take(length)) - # if(is_manager? || is_admin?) - # @bulletin.is_checked = true - # @bulletin.is_rejected = false - # @bulletin.de_pending! - # end - # if (params[:bulletin][:is_checked] == "false") - # @bulletin.is_rejected = true - # @bulletin.save! - # end - # if (@bulletin.deadline < @bulletin.postdate rescue nil) - # @bulletin.deadline = nil - # @bulletin.update_user_id = current_user.id - # @bulletin.save! - # end - # format.html { redirect_to(panel_announcement_back_end_bulletin_url(@bulletin), :notice => t('bulletin.update_bulletin_success')) } + if @bulletin.update_attributes(params[:bulletin]) + format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('bulletin.update_bulletin_success')) } format.js { render 'toggle_enable' } format.xml { head :ok } diff --git a/vendor/built_in_modules/announcement/app/models/bulletin.rb b/vendor/built_in_modules/announcement/app/models/bulletin.rb index 77fa12b6..5ba34da9 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin.rb @@ -38,6 +38,7 @@ class Bulletin accepts_nested_attributes_for :bulletin_links, :allow_destroy => true validates :title, :at_least_one => true + after_save :get_bulletin_tags def to_indexed_json self.to_json @@ -66,6 +67,16 @@ class Bulletin self.category end + def get_bulletin_tags + if self.changed? + tag = [] + tag << self.tags.map{|t| t.id.to_s}.uniq + # Rails.logger.info"@@@@@@@@@@@@@@@@"+tag.inspect + self.tagged_ids = tag + # self.upsert + end + end + def share_item Item.first(conditions:{name: 'announcement'}) end