Answer the question
In order to leave comments, you need to log in
Is it possible in rails to call a view with a parameter?
There are many identical tags, but for different objects. Is it possible somehow to use one view by simply passing the desired object there
Answer the question
In order to leave comments, you need to log in
Certainly. See what locals are: guides.rubyonrails.org/layouts_and_rendering.html
# controllers/users_controller.rb
@user = User.find(params[:id])
render 'shared/profile', resource: @user
# views/shared/_profile.html.erb
resource.name
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question