jquery - ActiveRecord::ImmutableRelation in rails 4 -
in controller:
def update @dtmrealshow= datetime.parse(params[:showtime][:dtmrealshow].to_s).strftime("%d/%m/%y %i:%m %p") @showtime.update(:dtmrealshow=> @dtmrealshow,:theatre_id=>params[:showtime][:theatre_id],:city_id=>params[:showtime][:city_id],:movie_id=>params[:showtime][:movie_id]) @showtimes = showtime.all.order(:created_at).paginate(:page => params[:page], :per_page => 8) end
in _index.html.erb
:
<% @showtimes.each |showtime| %> ------------------------- <% end %> <%= will_paginate @showtimes%>
in update.js.erb
:
$(document).ready(function(){ $('#divshow').html("<%= j (render 'showtimes/index') %>"); $('#mymodal').modal('hide'); $('#notice').html("showtime updated.").show(); });
in application using will_paginate gem.after update record getting http://localhost:3000/showtimes/45?page=4
url when clicked on pagination. want remove id=45
because causes error.
Comments
Post a Comment