Rails: v-model VueJS attribute
up vote
0
down vote
favorite
Inside a form tag i'm placing a hidden_field.
This hidden_field should have a "v-model" attribute.
I've tried all I can think about:
# nothing shows up
= f.hidden_field :model_attribute, "v-model" => "value"
# that's the one I love the most: it compiles v="{:model=>"value"}"
= f.hidden_field :model_attribute, v: { model: "value" }
# it compiles with the underscore
= f.hidden_field :model_attribute, v_model: "value"
# this throws a compile error, obviously
= f.hidden_field :model_attribute, v-model: "value"
# guess the compiled outcome?
= f.hidden_field :model_attribute, html: { "v-model" => "value" }
#same as previous
= f.hidden_field :model_attribute, options: { "v-model" => "value" }
is rails screwing with me?
Can anyone help me?
ruby-on-rails
add a comment |
up vote
0
down vote
favorite
Inside a form tag i'm placing a hidden_field.
This hidden_field should have a "v-model" attribute.
I've tried all I can think about:
# nothing shows up
= f.hidden_field :model_attribute, "v-model" => "value"
# that's the one I love the most: it compiles v="{:model=>"value"}"
= f.hidden_field :model_attribute, v: { model: "value" }
# it compiles with the underscore
= f.hidden_field :model_attribute, v_model: "value"
# this throws a compile error, obviously
= f.hidden_field :model_attribute, v-model: "value"
# guess the compiled outcome?
= f.hidden_field :model_attribute, html: { "v-model" => "value" }
#same as previous
= f.hidden_field :model_attribute, options: { "v-model" => "value" }
is rails screwing with me?
Can anyone help me?
ruby-on-rails
1
It looks like the field helpers in rails 5.1+ enforce html5 compatibility, since you are using an invalid field, I don't think you can build the element using the helper, you'd need to write out the entire html tag.
– DivXZero
Nov 19 at 20:31
You should think about why you want that hyphen, and whether or not you need it. I bet you have spent more time than you care to mention on this when you could have just used an underscore. So why not use an underscore?
– Carl Markham
Nov 19 at 20:41
to bind the vuejs to some field, one must use the "v-model" attribute. the underscore option is a fallback for when you are using data attributes, isn't it?
– Rafael Ravena Vicente
Nov 19 at 20:47
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Inside a form tag i'm placing a hidden_field.
This hidden_field should have a "v-model" attribute.
I've tried all I can think about:
# nothing shows up
= f.hidden_field :model_attribute, "v-model" => "value"
# that's the one I love the most: it compiles v="{:model=>"value"}"
= f.hidden_field :model_attribute, v: { model: "value" }
# it compiles with the underscore
= f.hidden_field :model_attribute, v_model: "value"
# this throws a compile error, obviously
= f.hidden_field :model_attribute, v-model: "value"
# guess the compiled outcome?
= f.hidden_field :model_attribute, html: { "v-model" => "value" }
#same as previous
= f.hidden_field :model_attribute, options: { "v-model" => "value" }
is rails screwing with me?
Can anyone help me?
ruby-on-rails
Inside a form tag i'm placing a hidden_field.
This hidden_field should have a "v-model" attribute.
I've tried all I can think about:
# nothing shows up
= f.hidden_field :model_attribute, "v-model" => "value"
# that's the one I love the most: it compiles v="{:model=>"value"}"
= f.hidden_field :model_attribute, v: { model: "value" }
# it compiles with the underscore
= f.hidden_field :model_attribute, v_model: "value"
# this throws a compile error, obviously
= f.hidden_field :model_attribute, v-model: "value"
# guess the compiled outcome?
= f.hidden_field :model_attribute, html: { "v-model" => "value" }
#same as previous
= f.hidden_field :model_attribute, options: { "v-model" => "value" }
is rails screwing with me?
Can anyone help me?
ruby-on-rails
ruby-on-rails
edited Nov 21 at 16:21
7urkm3n
3,38221130
3,38221130
asked Nov 19 at 20:24
Rafael Ravena Vicente
7316
7316
1
It looks like the field helpers in rails 5.1+ enforce html5 compatibility, since you are using an invalid field, I don't think you can build the element using the helper, you'd need to write out the entire html tag.
– DivXZero
Nov 19 at 20:31
You should think about why you want that hyphen, and whether or not you need it. I bet you have spent more time than you care to mention on this when you could have just used an underscore. So why not use an underscore?
– Carl Markham
Nov 19 at 20:41
to bind the vuejs to some field, one must use the "v-model" attribute. the underscore option is a fallback for when you are using data attributes, isn't it?
– Rafael Ravena Vicente
Nov 19 at 20:47
add a comment |
1
It looks like the field helpers in rails 5.1+ enforce html5 compatibility, since you are using an invalid field, I don't think you can build the element using the helper, you'd need to write out the entire html tag.
– DivXZero
Nov 19 at 20:31
You should think about why you want that hyphen, and whether or not you need it. I bet you have spent more time than you care to mention on this when you could have just used an underscore. So why not use an underscore?
– Carl Markham
Nov 19 at 20:41
to bind the vuejs to some field, one must use the "v-model" attribute. the underscore option is a fallback for when you are using data attributes, isn't it?
– Rafael Ravena Vicente
Nov 19 at 20:47
1
1
It looks like the field helpers in rails 5.1+ enforce html5 compatibility, since you are using an invalid field, I don't think you can build the element using the helper, you'd need to write out the entire html tag.
– DivXZero
Nov 19 at 20:31
It looks like the field helpers in rails 5.1+ enforce html5 compatibility, since you are using an invalid field, I don't think you can build the element using the helper, you'd need to write out the entire html tag.
– DivXZero
Nov 19 at 20:31
You should think about why you want that hyphen, and whether or not you need it. I bet you have spent more time than you care to mention on this when you could have just used an underscore. So why not use an underscore?
– Carl Markham
Nov 19 at 20:41
You should think about why you want that hyphen, and whether or not you need it. I bet you have spent more time than you care to mention on this when you could have just used an underscore. So why not use an underscore?
– Carl Markham
Nov 19 at 20:41
to bind the vuejs to some field, one must use the "v-model" attribute. the underscore option is a fallback for when you are using data attributes, isn't it?
– Rafael Ravena Vicente
Nov 19 at 20:47
to bind the vuejs to some field, one must use the "v-model" attribute. the underscore option is a fallback for when you are using data attributes, isn't it?
– Rafael Ravena Vicente
Nov 19 at 20:47
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
When asking a question. You have to mention, it's VueJS attribute.
Check this LINK
= f.hidden_field :model_attribute, "v-model": "val"
the expected rendering is <input type="hidden" name="model_class[model_attribute]" id="model_class_model_attribute" v-model="value" value=""/>, no data attributes needed.
– Rafael Ravena Vicente
Nov 19 at 21:00
@RafaelRavenaVicente updated my post check it
– 7urkm3n
Nov 19 at 23:54
yeah, it works great on select, text_field... just had trouble with rendering it on a hidden_field... just posted the question here when I was done trying to do it...
– Rafael Ravena Vicente
Nov 21 at 18:30
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
When asking a question. You have to mention, it's VueJS attribute.
Check this LINK
= f.hidden_field :model_attribute, "v-model": "val"
the expected rendering is <input type="hidden" name="model_class[model_attribute]" id="model_class_model_attribute" v-model="value" value=""/>, no data attributes needed.
– Rafael Ravena Vicente
Nov 19 at 21:00
@RafaelRavenaVicente updated my post check it
– 7urkm3n
Nov 19 at 23:54
yeah, it works great on select, text_field... just had trouble with rendering it on a hidden_field... just posted the question here when I was done trying to do it...
– Rafael Ravena Vicente
Nov 21 at 18:30
add a comment |
up vote
0
down vote
When asking a question. You have to mention, it's VueJS attribute.
Check this LINK
= f.hidden_field :model_attribute, "v-model": "val"
the expected rendering is <input type="hidden" name="model_class[model_attribute]" id="model_class_model_attribute" v-model="value" value=""/>, no data attributes needed.
– Rafael Ravena Vicente
Nov 19 at 21:00
@RafaelRavenaVicente updated my post check it
– 7urkm3n
Nov 19 at 23:54
yeah, it works great on select, text_field... just had trouble with rendering it on a hidden_field... just posted the question here when I was done trying to do it...
– Rafael Ravena Vicente
Nov 21 at 18:30
add a comment |
up vote
0
down vote
up vote
0
down vote
When asking a question. You have to mention, it's VueJS attribute.
Check this LINK
= f.hidden_field :model_attribute, "v-model": "val"
When asking a question. You have to mention, it's VueJS attribute.
Check this LINK
= f.hidden_field :model_attribute, "v-model": "val"
edited Nov 20 at 14:30
answered Nov 19 at 20:44
7urkm3n
3,38221130
3,38221130
the expected rendering is <input type="hidden" name="model_class[model_attribute]" id="model_class_model_attribute" v-model="value" value=""/>, no data attributes needed.
– Rafael Ravena Vicente
Nov 19 at 21:00
@RafaelRavenaVicente updated my post check it
– 7urkm3n
Nov 19 at 23:54
yeah, it works great on select, text_field... just had trouble with rendering it on a hidden_field... just posted the question here when I was done trying to do it...
– Rafael Ravena Vicente
Nov 21 at 18:30
add a comment |
the expected rendering is <input type="hidden" name="model_class[model_attribute]" id="model_class_model_attribute" v-model="value" value=""/>, no data attributes needed.
– Rafael Ravena Vicente
Nov 19 at 21:00
@RafaelRavenaVicente updated my post check it
– 7urkm3n
Nov 19 at 23:54
yeah, it works great on select, text_field... just had trouble with rendering it on a hidden_field... just posted the question here when I was done trying to do it...
– Rafael Ravena Vicente
Nov 21 at 18:30
the expected rendering is <input type="hidden" name="model_class[model_attribute]" id="model_class_model_attribute" v-model="value" value=""/>, no data attributes needed.
– Rafael Ravena Vicente
Nov 19 at 21:00
the expected rendering is <input type="hidden" name="model_class[model_attribute]" id="model_class_model_attribute" v-model="value" value=""/>, no data attributes needed.
– Rafael Ravena Vicente
Nov 19 at 21:00
@RafaelRavenaVicente updated my post check it
– 7urkm3n
Nov 19 at 23:54
@RafaelRavenaVicente updated my post check it
– 7urkm3n
Nov 19 at 23:54
yeah, it works great on select, text_field... just had trouble with rendering it on a hidden_field... just posted the question here when I was done trying to do it...
– Rafael Ravena Vicente
Nov 21 at 18:30
yeah, it works great on select, text_field... just had trouble with rendering it on a hidden_field... just posted the question here when I was done trying to do it...
– Rafael Ravena Vicente
Nov 21 at 18:30
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53382106%2frails-v-model-vuejs-attribute%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
It looks like the field helpers in rails 5.1+ enforce html5 compatibility, since you are using an invalid field, I don't think you can build the element using the helper, you'd need to write out the entire html tag.
– DivXZero
Nov 19 at 20:31
You should think about why you want that hyphen, and whether or not you need it. I bet you have spent more time than you care to mention on this when you could have just used an underscore. So why not use an underscore?
– Carl Markham
Nov 19 at 20:41
to bind the vuejs to some field, one must use the "v-model" attribute. the underscore option is a fallback for when you are using data attributes, isn't it?
– Rafael Ravena Vicente
Nov 19 at 20:47