Ruby on Rails Wednesday, May 4, 2016

How can do this?

<%= link_to "Details", refin_details_refin_path(@refin), 'data-toggle' => 'modal', 'data-target' => '#modal-show-refin', :remote => true %>
<div class="modal fade" id="modal-show-refin" role="dialog" tabindex="-1">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button aria-label="Close" class="close" data-dismiss="modal" type="button">
          <span aria-hidden="true">&times;</span>
        </button>
        <h4 class="modal-title">Details of refin</h4>
      </div>
      <div class="modal-body"></div>
    </div>
  </div>
</div>

routes.rb
  resources :refinancings do
      get 'details_refin'
  end

refinancings_controller.rb
def details_refin
    @refin = Refinancing.find(params[:refinancing_id])
  end

I receive this error:

No route matches {:action=>"details_refin", :controller=>"refinancings", :refinancing_id=>nil} missing required keys: [:refinancing_id]


I have too this:
details_refin.js.erb
$(".modal-body").empty();
$('.modal-body').html('#{escape_javascript(render 'details_refin')}');
$("#modal-show-refin").modal('show');


Somebody can help me, please? 

--
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+unsubscribe@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/07478ba0-448b-4719-b4a7-de235b2a9d05%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment