Class: ErpApp::Organizer::Crm::RelationshipController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- ApplicationController
- BaseController
- ErpApp::Organizer::Crm::RelationshipController
- Defined in:
- app/controllers/erp_app/organizer/crm/relationship_controller.rb
Instance Method Summary collapse
Instance Method Details
#get_party_relationship ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/erp_app/organizer/crm/relationship_controller.rb', line 20 def get_party_relationship party = Party.find(params[:party_id]) relationships = party.find_relationships_by_type(params[:relationship_type]) total_count = relationships.length {:totalCount => total_count, :data => relationships.collect do |relation| = relation.to_party { :party_id => .id, :party_desc => .description, :relationship => relation.description, :created_at => relation.created_at, :updated_at => relation.updated_at, :from_date => relation.from_date, :thru_date => relation.thru_date, :role_type => relation.to_role } end }.to_json end |
#index ⇒ Object
6 7 8 9 10 11 12 |
# File 'app/controllers/erp_app/organizer/crm/relationship_controller.rb', line 6 def index render :inline => if request.get? get_party_relationships end end |
#to_party_relationship_types ⇒ Object
14 15 16 17 18 |
# File 'app/controllers/erp_app/organizer/crm/relationship_controller.rb', line 14 def to_party_relationship_types party = Party.find(params[:party_id]) relationship_types = party.to_relationships.collect(&:relationship_type) end |