Rails Ajax: .js.erb rendered as text, not JS

前端 未结 4 1112
情话喂你
情话喂你 2020-12-09 23:05

I\'m having a trouble with rails3 to render Javascript (If this is relevant, I use JQuery and it works fine since it\'s used in numerous other parts of the application) inst

4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-09 23:10

    Seems a little late to be providing this answer, but better late that never.

    You are mixing up respond_to and respond_with. At the top of your controller class use respond_to :js, :html. Then put this in your edit action

    def edit
      @user_repreneur = UserRepreneur.find_by_id_view(params[:id])
      respond_with @user _repreneur
    end 
    

提交回复
热议问题