aces / cbrain

CBRAIN is a flexible Ruby on Rails framework for accessing and processing of large data on high-performance computing infrastructures.
GNU General Public License v3.0
71 stars 42 forks source link

ParamsErrors don't highlight input fields for deep params #518

Closed prioux closed 8 years ago

prioux commented 8 years ago

If an error in a CbrainTask's params is recorded, where the param is deep inside the hash, as in the paramspath myhash[mykey] or deeper:

task.params_errors["myhash[mykey]"] = "is bad"

then in the task's param's page the field will not by highlighted in red. The reason is that the ID of the input field will be provided by the .to_la_id() method and will be shown as

<input id="cbrain_task_params_myhash_mykey">

whereas in the params_errors object they key is stored as the symbol :"cbrain_task_params_myhash[mykey]" (yes a symbol with brackets in its name).

This was convenient because it allowed the entire API of ParamsErrors to always provide the developer a consistent interface using paramspaths; however now Rails fail to match the ID and the fact that an error was recorded.

Not sure how to solve that yet; maybe stuff the errors object with a duplicate key :cbrain_task_params_myhash_mykey key ?

prioux commented 8 years ago

Got a solution working using a new to_la_id() (and reverse) in an experimental branch...

prioux commented 8 years ago

Fixed by #520