Changeset 2210

Show
Ignore:
Timestamp:
05-04-12 17:25:41 (2 years ago)
Author:
work@…
Message:

- improved api service

Location:
trunk/grails-app
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/api/ApiController.groovy

    r2206 r2210  
    281281            } 
    282282        } 
    283  
    284283    } 
    285284 
  • trunk/grails-app/services/api/ApiService.groovy

    r2209 r2210  
    3030    // transactional 
    3131    static transactional = false 
     32 
     33    // characters to split on when converting a string to camelCased format 
     34    static camelCaseSeperators = " |-|_" 
    3235 
    3336    // hasMany keys to ignore when flattening domain data 
     
    112115            fields.each { field -> 
    113116                // get a camelCased version of the field name 
    114                 def name = field.name.split(" ").collect {it[0].toUpperCase() + it.substring(1)}.join('') 
     117                def name = field.name.split(camelCaseSeperators).collect {it[0].toUpperCase() + it.substring(1)}.join('') 
    115118                    name = name[0].toLowerCase() + name.substring(1) 
    116119