RailsCasts Pro episodes are now free!

Learn more or hide this

Poc's Profile

GitHub User: poc7667

Comments by Poc


I've done the nested form by referencing to http://railscasts.com/episodes/196-nested-model-form-revised?

I can fill three models' data in one form now,

But How to saving the form data and make it available to re-fill the form ?

The relations of the models is 'One survey has many questions,and one question has many answers,'

My roughly thinking is, save all the survey_params in surveys_controller.rb

Maybe I should create a new model FormRecord to keep all the form records,

And when user comes to the form-page next time,

it'll selecting all the records he made,
and provide a checkbox and button to let him decide which form-data record he wants to fill the form.

But I have no idea what kind of the data structure I should have,

And How to fill the form via Javascript.

Is there any idea ? or reference ?


I followed the tutorial of Nested Model Form (revised) http://railscasts.com/episodes/196-nested-model-form-revised?view=comments

Which is about how to create a survey with multiple models,

But I wonder how to make to survey cab be a real survey.

Let user can answer those questions and I can gather the user's feedback.



I followed the railscast tutorial , but I found I can not load the "saved tokens".

I think the problem is that when click 'edit' link (created by scaffold),

it didn't trigger the preload function, how do you fix the problems in Rails 4

enter image description here

View page

    = f.input :name
    = f.input :content
    = f.text_field :user_tokens, data: {load: @article.users}

My coffeescript

$(document).ready -> 
  $('#article_user_tokens').tokenInput '/users.json',
    theme: 'facebook',
    prePopulate: $('#article_user_tokens').data('load')

Require the css and js file

 *= require token-input-facebook
 //= require jquery.tokeninput

I see render @incompletetasks, but I didn't see the _incomplete_task.html.erb ? I'm using Rails 3.2.13 and give me missing template error==