Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Poc's Profile

GitHub User: poc7667

Comments by Poc

Avatar

Hi All I follow the Rails cast

But Got the following error.

I'm pretty sure the error's reason is the new version ember-rails. (Because if I upgrade the gems in the cast episode, it will get the same error)

But I don't know How to fix the problem.

entry.js.coffee

# for more details see: http://emberjs.com/guides/models/defining-models/
App.Entry = DS.Model.extend
  name: DS.attr 'string'
  winner: DS.attr 'boolean'

router.js

# For more information see: http://emberjs.com/guides/routing/
App.Router.map ()->
  # @resource('posts')
  @route 'entries', path: '/'


App.EntriesRoute = Ember.Route.extend
  # setupController: (controller) -> controller.set('content', [])
  model: -> App.Entry.find()

  setupController: (controller, model) ->
    controller.set "content", model
    return

store.js.coffee

# http://emberjs.com/guides/models/#toc_store
# http://emberjs.com/guides/models/pushing-records-into-the-store/

App.Store = DS.Store.extend
  revision: 11


DS.RESTAdapter.configure("plurals", entry: "entries")

Error

Uncaught TypeError: undefined is not a function store.js:6
Error while processing route: entries undefined is not a function TypeError: undefined is not a function
    at App.EntriesRoute.Ember.Route.extend.model (http://localhost:3000/assets/router.js?body=1:10:24)
    at apply (http://localhost:3000/assets/ember.js?body=1:18382:27)
    at superWrapper [as model] (http://localhost:3000/assets/ember.js?body=1:17959:15)
    at EmberObject.extend.deserialize (http://localhost:3000/assets/ember.js?body=1:23252:23)
    at applyHook (http://localhost:3000/assets/ember.js?body=1:45491:30)
    at Object.HandlerInfo.runSharedModelHook (http://localhost:3000/assets/ember.js?body=1:43517:22)
    at Object.subclass.getModel (http://localhost:3000/assets/ember.js?body=1:43743:21)
    at http://localhost:3000/assets/ember.js?body=1:45365:19
    at tryCatch (http://localhost:3000/assets/ember.js?body=1:45819:16)
    at invokeCallback (http://localhost:3000/assets/ember.js?body=1:45831:17) 
Avatar

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 ?

Avatar

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.

Avatar

http://stackoverflow.com/questions/23212898/tokeninput-not-load-the-existing-data-unless-reloading-page

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

  .form-inputs
    = 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
Avatar

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==