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
-
#get_party_relationships ⇒ Object
This method returns all party relationships that involve the params and the passed in relationship type.
-
#index ⇒ Object
RESTful controller for party relationship data.
Methods inherited from BaseController
#get_preferences, #setup_preferences, #update_preferences
Instance Method Details
#get_party_relationships ⇒ Object
This method returns all party relationships that involve the params and the passed in relationship type. Use this when you just need generic information about a relationship passed back. Formats into a hash for consumption by an ExtJS GridPanel
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/erp_app/organizer/crm/relationship_controller.rb', line 23 def get_party_relationships 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
RESTful controller for party relationship data
9 10 11 12 13 14 |
# File 'app/controllers/erp_app/organizer/crm/relationship_controller.rb', line 9 def index render :inline => if request.get? get_party_relationships end end |