Ruby on Rails - Partial not rendering link on creation
up vote
0
down vote
favorite
Yo guys, I'm learning Rails and having a interesing problem
I have a this partial.
_access_point.html.erb
<div class="card">
<div class="card-body">
<div class="card-title">
<h3 class="text-center"><%= link_to_unless_current access_point.model.upcase, [access_point] %><%= link_to [:edit, access_point], remote: true, class: 'float-right' do fa_icon 'edit lg' end %></h3>
</div>
<div class="card-text">
<p><strong>Manufacturer: </strong><%= access_point.manufacturer %></p>
<p><strong>Serial number: </strong><%= access_point.serial_number %></p>
<p><strong>USER: </strong><%= access_point.user %></p>
<p><strong>PASSWORD: </strong><%= access_point.password %></p>
</div>
</div>
</div>
create.js.erb
$('#access-points-cards').append('<%= j render partial: 'access_point', locals: { access_point: @access_point }, layout: 'layouts/col-md-4' %>')
$('#new-access-point').modal('hide')
and I´m using a modal form, with remote: true to create it, after inserting the EDIT button don´t show up in the browser, but show in the dev tools, if I hit F5 it shows everything ok, don´t know if its a turbolinks problem or something like that.
Can you help me?
javascript ruby-on-rails ruby ruby-on-rails-5
add a comment |
up vote
0
down vote
favorite
Yo guys, I'm learning Rails and having a interesing problem
I have a this partial.
_access_point.html.erb
<div class="card">
<div class="card-body">
<div class="card-title">
<h3 class="text-center"><%= link_to_unless_current access_point.model.upcase, [access_point] %><%= link_to [:edit, access_point], remote: true, class: 'float-right' do fa_icon 'edit lg' end %></h3>
</div>
<div class="card-text">
<p><strong>Manufacturer: </strong><%= access_point.manufacturer %></p>
<p><strong>Serial number: </strong><%= access_point.serial_number %></p>
<p><strong>USER: </strong><%= access_point.user %></p>
<p><strong>PASSWORD: </strong><%= access_point.password %></p>
</div>
</div>
</div>
create.js.erb
$('#access-points-cards').append('<%= j render partial: 'access_point', locals: { access_point: @access_point }, layout: 'layouts/col-md-4' %>')
$('#new-access-point').modal('hide')
and I´m using a modal form, with remote: true to create it, after inserting the EDIT button don´t show up in the browser, but show in the dev tools, if I hit F5 it shows everything ok, don´t know if its a turbolinks problem or something like that.
Can you help me?
javascript ruby-on-rails ruby ruby-on-rails-5
So the_access_point
partial isn't rendered at all or there are some problems with it after it got rendered?
– bernstein7
Nov 8 at 16:03
it is rendered normally.<h3 class="text-center"><%= link_to_unless_current access_point.model.upcase, [access_point] %><%= link_to [:edit, access_point], remote: true, class: 'float-right' do fa_icon 'edit lg' end %></h3>
in this part of the partial, the link_to_unless_current works normally, but the fa_icon doesn´t show
– Joz
Nov 9 at 10:13
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Yo guys, I'm learning Rails and having a interesing problem
I have a this partial.
_access_point.html.erb
<div class="card">
<div class="card-body">
<div class="card-title">
<h3 class="text-center"><%= link_to_unless_current access_point.model.upcase, [access_point] %><%= link_to [:edit, access_point], remote: true, class: 'float-right' do fa_icon 'edit lg' end %></h3>
</div>
<div class="card-text">
<p><strong>Manufacturer: </strong><%= access_point.manufacturer %></p>
<p><strong>Serial number: </strong><%= access_point.serial_number %></p>
<p><strong>USER: </strong><%= access_point.user %></p>
<p><strong>PASSWORD: </strong><%= access_point.password %></p>
</div>
</div>
</div>
create.js.erb
$('#access-points-cards').append('<%= j render partial: 'access_point', locals: { access_point: @access_point }, layout: 'layouts/col-md-4' %>')
$('#new-access-point').modal('hide')
and I´m using a modal form, with remote: true to create it, after inserting the EDIT button don´t show up in the browser, but show in the dev tools, if I hit F5 it shows everything ok, don´t know if its a turbolinks problem or something like that.
Can you help me?
javascript ruby-on-rails ruby ruby-on-rails-5
Yo guys, I'm learning Rails and having a interesing problem
I have a this partial.
_access_point.html.erb
<div class="card">
<div class="card-body">
<div class="card-title">
<h3 class="text-center"><%= link_to_unless_current access_point.model.upcase, [access_point] %><%= link_to [:edit, access_point], remote: true, class: 'float-right' do fa_icon 'edit lg' end %></h3>
</div>
<div class="card-text">
<p><strong>Manufacturer: </strong><%= access_point.manufacturer %></p>
<p><strong>Serial number: </strong><%= access_point.serial_number %></p>
<p><strong>USER: </strong><%= access_point.user %></p>
<p><strong>PASSWORD: </strong><%= access_point.password %></p>
</div>
</div>
</div>
create.js.erb
$('#access-points-cards').append('<%= j render partial: 'access_point', locals: { access_point: @access_point }, layout: 'layouts/col-md-4' %>')
$('#new-access-point').modal('hide')
and I´m using a modal form, with remote: true to create it, after inserting the EDIT button don´t show up in the browser, but show in the dev tools, if I hit F5 it shows everything ok, don´t know if its a turbolinks problem or something like that.
Can you help me?
javascript ruby-on-rails ruby ruby-on-rails-5
javascript ruby-on-rails ruby ruby-on-rails-5
asked Nov 8 at 14:15
Joz
1
1
So the_access_point
partial isn't rendered at all or there are some problems with it after it got rendered?
– bernstein7
Nov 8 at 16:03
it is rendered normally.<h3 class="text-center"><%= link_to_unless_current access_point.model.upcase, [access_point] %><%= link_to [:edit, access_point], remote: true, class: 'float-right' do fa_icon 'edit lg' end %></h3>
in this part of the partial, the link_to_unless_current works normally, but the fa_icon doesn´t show
– Joz
Nov 9 at 10:13
add a comment |
So the_access_point
partial isn't rendered at all or there are some problems with it after it got rendered?
– bernstein7
Nov 8 at 16:03
it is rendered normally.<h3 class="text-center"><%= link_to_unless_current access_point.model.upcase, [access_point] %><%= link_to [:edit, access_point], remote: true, class: 'float-right' do fa_icon 'edit lg' end %></h3>
in this part of the partial, the link_to_unless_current works normally, but the fa_icon doesn´t show
– Joz
Nov 9 at 10:13
So the
_access_point
partial isn't rendered at all or there are some problems with it after it got rendered?– bernstein7
Nov 8 at 16:03
So the
_access_point
partial isn't rendered at all or there are some problems with it after it got rendered?– bernstein7
Nov 8 at 16:03
it is rendered normally.
<h3 class="text-center"><%= link_to_unless_current access_point.model.upcase, [access_point] %><%= link_to [:edit, access_point], remote: true, class: 'float-right' do fa_icon 'edit lg' end %></h3>
in this part of the partial, the link_to_unless_current works normally, but the fa_icon doesn´t show– Joz
Nov 9 at 10:13
it is rendered normally.
<h3 class="text-center"><%= link_to_unless_current access_point.model.upcase, [access_point] %><%= link_to [:edit, access_point], remote: true, class: 'float-right' do fa_icon 'edit lg' end %></h3>
in this part of the partial, the link_to_unless_current works normally, but the fa_icon doesn´t show– Joz
Nov 9 at 10:13
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
Your problem should be the view is not being updated in the DOM properly.
So instead of appending try this:
- Render your
access_point
view on your page always
Change your partial to be hidden with:
access_point.html.erb :
<div class="card hidden">
some_css_file :
hidden { display: none }
Show partial on js call
create.js.erb
$('.card').show()
$('#new-access-point').modal('hide')
Decide where to place
$('.card').hide()
if needed
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
Your problem should be the view is not being updated in the DOM properly.
So instead of appending try this:
- Render your
access_point
view on your page always
Change your partial to be hidden with:
access_point.html.erb :
<div class="card hidden">
some_css_file :
hidden { display: none }
Show partial on js call
create.js.erb
$('.card').show()
$('#new-access-point').modal('hide')
Decide where to place
$('.card').hide()
if needed
add a comment |
up vote
1
down vote
Your problem should be the view is not being updated in the DOM properly.
So instead of appending try this:
- Render your
access_point
view on your page always
Change your partial to be hidden with:
access_point.html.erb :
<div class="card hidden">
some_css_file :
hidden { display: none }
Show partial on js call
create.js.erb
$('.card').show()
$('#new-access-point').modal('hide')
Decide where to place
$('.card').hide()
if needed
add a comment |
up vote
1
down vote
up vote
1
down vote
Your problem should be the view is not being updated in the DOM properly.
So instead of appending try this:
- Render your
access_point
view on your page always
Change your partial to be hidden with:
access_point.html.erb :
<div class="card hidden">
some_css_file :
hidden { display: none }
Show partial on js call
create.js.erb
$('.card').show()
$('#new-access-point').modal('hide')
Decide where to place
$('.card').hide()
if needed
Your problem should be the view is not being updated in the DOM properly.
So instead of appending try this:
- Render your
access_point
view on your page always
Change your partial to be hidden with:
access_point.html.erb :
<div class="card hidden">
some_css_file :
hidden { display: none }
Show partial on js call
create.js.erb
$('.card').show()
$('#new-access-point').modal('hide')
Decide where to place
$('.card').hide()
if needed
answered Nov 8 at 17:08
Federico
5311
5311
add a comment |
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%2f53209574%2fruby-on-rails-partial-not-rendering-link-on-creation%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
So the
_access_point
partial isn't rendered at all or there are some problems with it after it got rendered?– bernstein7
Nov 8 at 16:03
it is rendered normally.
<h3 class="text-center"><%= link_to_unless_current access_point.model.upcase, [access_point] %><%= link_to [:edit, access_point], remote: true, class: 'float-right' do fa_icon 'edit lg' end %></h3>
in this part of the partial, the link_to_unless_current works normally, but the fa_icon doesn´t show– Joz
Nov 9 at 10:13