[WIP] Rails 4 upgrade

Just some fixes that are included for the rails 4 update at https://github.com/crowbar/barclamp-crowbar/pull/1157 for getting feedback.
What if there's no order key? I assume this translates to 0, and makes the items appear first. I think having them last would make more sense.