vendredi 16 juin 2017

how to get params[:id] of @post when you have layout: false

I am new to rails and want to create a model where every Post#show comes into a bootstrap-modal not into a separate show.html.erb page.. in my show controller i have something like this

def show 
  @confessions = Confession.find(params[:id])
  @comment = Confessioncomment.where(confession_id: @confessions).paginate(page: params[:page], per_page: 5).order('created_at ASC')
end

I am getting my @confessions from the params[:id] as of now to show the exact post I clicked on

but what I want is not to show a separate show page but to load everything in my bootstrap-modal on the same page.

I know I can use layout :false to tell that show will have no layout but I am not sure how to use it.. or if there is any other way to do this, please help.

how can I show post on same page rather than loading a new page from controller.

any ideas ?

Aucun commentaire:

Enregistrer un commentaire