mercredi 24 juin 2015

Render partial along with another object

This is my controller method:

def update
  @properties = Property.all
  @user = User.all

  respond_to do |format|
    format.js { render partial: 'property_all' }
  end
end

While rendering partial, can I also render another object something like below which can be captured in AJAX request?

format.js { render partial: 'property_all', user: @user } 

AJAX:

success : function (response, object) {
}

Aucun commentaire:

Enregistrer un commentaire