Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save aya-soft/7408dff8b3c18f4704c8754c91ed5721 to your computer and use it in GitHub Desktop.
Save aya-soft/7408dff8b3c18f4704c8754c91ed5721 to your computer and use it in GitHub Desktop.
Как ты не видишь где что лежит из данных - я не понимаю! Все ж на своих местах!
def new
unless current_user.service_station.present?
redirect_to new_profile_service_station_path
else
service = current_user.service_station.service_station_comments.where("spare_id = ?", params[:spare_id])
if service.present?
redirect_to "/profile/service_station_comments/#{service.first.id}/edit"
end
@comment = ServiceStationComment.new
gon.labor_times_price = current_user.service_station.labor_times_price
end
end
@aya-soft
Copy link
Author

      @comment = ServiceStationComment.new
      gon.labor_times_price = current_user.service_station.labor_times_price

Как я уже писал gon.labor_times_price надо заменить. Вопрос на что?

Можно так сделать:

@labor_times_price = current_user.service_station.labor_times_price

@romhi
Copy link

romhi commented May 30, 2016

Объясняю. Простую переменную из контроллера руби в js код просто так не вставить. Gen GON специально для этого предназначен, как я понял. Если сделать, как ты говоришь, я не получу переменную в нужном мне месте в js

@romhi
Copy link

romhi commented May 30, 2016

Разобрался! Спасибо. Буду иметь ввиду.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment