I managed to get the _form to display inside of the modal and fire off.
I'm having trouble with displaying show actions inside of the modal.

The error that I'm receiving is undefined method 'user' for
nil:NilClass. The data request is not transferring over to the show
action when I click the link_to button. I'll post what I wrote beneath
this. Thanks.


posts/_posts.html.erb

<% @post_items.each do |post| %>

<%= link_to image_tag(post.photo.url(:medium), style: 'height: 300px;
width: 500px;', lazy: true), post_path(controller: :posts, :action =>
:show, :id => post.id), remote: true, data: {:toggle => 'modal', :target
=> '#myModal'} %>

<% end %>

   <div id="post-modal" class="modal fade"></div>

        <!-- Modal -->
        <div class="modal fade" id="myModal" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
          <div class="modal-dialog" role="document">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"
aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="myModalLabel">Show Page for
Post</h4>
              </div>
              <div class="modal-body">
                <%= render 'posts/post', :locals => {post: post } %>
              </div>
            </div>
          </div>
        </div>

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/6f2e5eacfb5fff97e9a0b96794349b23%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to