我一直在看,并在我的应用程序复制这些railscasts: 196嵌套建模外形部分-1 和 197嵌套模型外形部分-2 。我还没有一个亲帐户,所以我不能观看修改后的情节。
I've been watching and reproducing these railscasts on my app: 196-nested-model-form-part-1 and 197-nested-model-form-part-2. I do not yet have a pro account so i can't watch the revised episode.
我在rails4(EDGE)和 link_to_function
已去precated赞成unobstrusive JS的(这是伟大的)。
I'm developing under rails4 (edge) and link_to_function
has been deprecated in favor of unobstrusive JS (which is great).
我会保持上述railscasts的例子(即调查/问题)。 我想要做的是用疑问的部分,通过unobstrusive的JavaScript,我只是不知道如何以及在哪里我应该这样做。
I'll keep the example of the above railscasts (i.e. survey/question). What i'd like to do is to use the question's partial through unobstrusive javascript and i just don't know how and where i should do this.
我想通过两种方式来完成:
I was thinking of two ways to do so :
在第一个方法是在我的应用程序/资产/ JavaScript代码
文件 surveys.js
添加的功能 add_question
,但我看不出我可以用我的部分从这里开始。
在其他的方法是创建一个新的动作我 SurveyController
,将用响应的问题部分,但我对有一个具体的行动对问题的事实困扰在我调查的控制器。
First way would be to add in my app/assets/javascripts
a file surveys.js
with the function add_question
but i don't see how i could use my partial from here.
Other way would be to create a new action in my SurveyController
that would respond using the question partial but i'm bothered by the fact of having an action specific to questions in my survey controller.
我不禁想到必须有一个更好的方式来做到这一点。
I can't help to think there must be a better way to do this.
推荐答案
我没有对Railscasts亲任一账户,但有时要看看的
相关推荐
最新文章