captured sparks

You can talk to me, or trackback from your own site. Or, if you're looking for more things to read? Why not check out the Archive.

  1. awesome tutorial!

  2. I really liked this video. I’ve read about named scopes but never really understood their basic use case until I watched this. I liked how you didn’t just run rails g scaffold but instead built it by hand showing each part and why it falls where it does in the process. I never knew about the routes nesting that was done for me behind the scenes either. Thanks!

    I would very much like a third part on added javascript to your todooly. :-)

  3. A really great tutorial! :)

  4. Great tutorial, I’m just starting out on Rails and this is the only tutorial i have found that really gives you an understanding of what’s going on, without going so slow that you are bored to death. I’m looking forward to any others you do in the future A+!!!

  5. Hey, I thought this tutorial was great.

    I took it a step further and made adding tasks ajaxed and also put ajax filtering for complete/incomplete tasks.

    I would like to make a video and stuff so if you could post the source as a github project I could start the video from getting the project from github and the code would be right where you left it and continue it.

    Cheers

  6. Robin Fisher said at 1:41 pm on September 5, 2011

    Hi Joel,

    Good idea. Check my Github account this weekend and I’ll put it up there.

    Robin

  7. Daniel Arzuaga said at 4:29 pm on September 6, 2011

    Great tutorial Robin, you are a great teacher man.

    I’m pretty new to rails and i was able to understand everything and follow along with no problems.

    Keep em coming

  8. Great tutorial! Really learning a lot! Just running into one thing -

    in routes.rb I have:

    resources :lists do
    resources :tasks
    end

    match ‘lists/:list_id/tasks/:id/complete’ => ‘tasks#complete’, :as => :complete_task

    root :to=> “lists#index”

    But I get this error when trying to use the app:

    No route matches {:list_id=>1, :controller=>”tasks”, :action=>”complete”, :id=>nil}

    What did I screw up on?

    Thanks

  9. Robin Fisher said at 6:53 am on September 15, 2011

    It appears that the id for the task is not being passed in. Your code should be:

    complete_task_path(@list.id,task.id)

    Are you passing the task.id into the link? Note there is no @ symbol before it in this case.

    Robin

  10. Is my button code if that helps, it looks like it is all there to me, really confusing me!

  11. %= button_to “Complete”, complete_task_path(@list.id,task.id) % – brackets are by % signs, not showing up though

  12. I got the same error Ryan did. I think the problem is in the controller? (Disclosure: not a rails dev)

    It seems the task created by:

    def show
    @list = List.find(params[:id])
    @task = @list.tasks.new
    end

    is appended to the @list.tasks, and shows up as an extra list item task in the lists/show view?

    I’m on OSX Snow Leopard, Ruby 1.8.7, Rails 3.1.1 and followed the tutorial to a “t” (character by character, watched everything 3 times) could it be a version/gem idiosyncrasy somewhere?

  13. I was able to get the new task item on the show list page to work correctly for me:

    i changed my ListController show method from:

    def show
    @list = List.find(params[:id])
    @task = @list.tasks.new
    end

    to :

    def show
    @list = List.find(params[:id])
    @task = @list.tasks.new
    end

    and my list/show page form from

    form_for [@list, @task] do |form|

    to :

    form_for [@list, @list.tasks.new] do |form|

    and boom! like magic. Any insights to why that might be happening?

  14. Robin Fisher said at 9:29 am on October 25, 2011

    Hi Johnny! Yes, does look like the new task is being appended to the list but because it’s not been created, it doesn’t have an id and that’s why the error is thrown. It may have been a change in Rails that causes initialised but not created objects to be added to a collection.

  15. Hi Robin! This is my first attempt at any rails code EVER! I’ve been following along quite smoothly until I hit the same error message as Ryan and Johnny.

    ….. No route matches {:controller=>”tasks”, :action=>”complete”, :list_id=>2, :id=>nil}

    I have rails v 3.1.3 Johnny posted a fix which I attempted to implement but it does not seem to work for me – the error message remains exactly the same.

    Could Johnny perhaps have made an error in his post? His fix for the ListController Show method doesn’t seem to change your code in any way.

    QUOTE:

    i changed my ListController show method from:

    def show
    @list = List.find(params[:id])
    @task = @list.tasks.new
    end

    to :

    def show
    @list = List.find(params[:id])
    @task = @list.tasks.new
    end

    Those two bits seem to be identical?

    Please help – I was so enjoying the tutorial and would love to complete it before my holiday is over :)

    Thanks a million!

Talk to me