简体   繁体   中英

Rails 3 working with data attributes

I am working on a form that does an autosave functionality and am having an issue working with data-* attributes..

Here is an input:

<input class="span2 autosave" data-athlete-id="58" data-event="blur" data-object-name="stat" data-stat-type-id="1" data-url="/stats" id="stat_value" maxlength="4" name="stat[value]" size="4" type="text" value="4.04">

When I serialize this input to pass it to my StatsController , athlete_id is passed in as athleteId ... how do I pass in the data-attribute of athlete_id as athlete_id (or any data attr that's longer than one word)?

我相信您正在寻找的答案是data-athlete_id

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM