Permalink
Browse files

Fixed order in generated SkinnyResource code

  • Loading branch information...
1 parent 44933ea commit c81e6cb805ccbc2a2bd584d5a28634d156f0ed9f @seratch seratch committed Mar 7, 2014
@@ -240,18 +240,18 @@ trait ScaffoldGenerator extends CodeGenerator {
| override def viewsDirectoryPath = s"${toResourcesBasePath(namespaces)}/$${toSnakeCase(resourcesName)}"
| override def useSnakeCasedParamKeys = true
|
+ | override def createParams = Params(params)${params}
| override def createForm = validation(createParams,
|${validations}
| )
- | override def createParams = Params(params)${params}
| override def createFormStrongParameters = Seq(
|${args.map { a => " \"" + toSnakeCase(a.name) + "\" -> ParamType." + toParamType(a.typeName) }.mkString(",\n")}
| )
|
+ | override def updateParams = Params(params)${params}
| override def updateForm = validation(updateParams,
|${validations}
| )
- | override def updateParams = Params(params)${params}
| override def updateFormStrongParameters = Seq(
|${args.map { a => " \"" + toSnakeCase(a.name) + "\" -> ParamType." + toParamType(a.typeName) }.mkString(",\n")}
| )
@@ -42,6 +42,7 @@ class ScaffoldGeneratorSpec extends FunSpec with ShouldMatchers {
| override def viewsDirectoryPath = s"/admin/${toSnakeCase(resourcesName)}"
| override def useSnakeCasedParamKeys = true
|
+ | override def createParams = Params(params).withDate("birthday").withTime("time_to_wake_up").withDateTime("created_at")
| override def createForm = validation(createParams,
| paramKey("name") is required & maxLength(512),
| paramKey("favorite_int_number") is required & numeric & intValue,
@@ -54,7 +55,6 @@ class ScaffoldGeneratorSpec extends FunSpec with ShouldMatchers {
| paramKey("time_to_wake_up") is timeFormat,
| paramKey("created_at") is required & dateTimeFormat
| )
- | override def createParams = Params(params).withDate("birthday").withTime("time_to_wake_up").withDateTime("created_at")
| override def createFormStrongParameters = Seq(
| "name" -> ParamType.String,
| "favorite_int_number" -> ParamType.Int,
@@ -69,6 +69,7 @@ class ScaffoldGeneratorSpec extends FunSpec with ShouldMatchers {
| "created_at" -> ParamType.DateTime
| )
|
+ | override def updateParams = Params(params).withDate("birthday").withTime("time_to_wake_up").withDateTime("created_at")
| override def updateForm = validation(updateParams,
| paramKey("name") is required & maxLength(512),
| paramKey("favorite_int_number") is required & numeric & intValue,
@@ -81,7 +82,6 @@ class ScaffoldGeneratorSpec extends FunSpec with ShouldMatchers {
| paramKey("time_to_wake_up") is timeFormat,
| paramKey("created_at") is required & dateTimeFormat
| )
- | override def updateParams = Params(params).withDate("birthday").withTime("time_to_wake_up").withDateTime("created_at")
| override def updateFormStrongParameters = Seq(
| "name" -> ParamType.String,
| "favorite_int_number" -> ParamType.Int,

0 comments on commit c81e6cb

Please sign in to comment.