Does it work when you run Captionfile.all in your rails console?

On Friday, March 9, 2012 11:52:34 AM UTC-8, AndyLikesRuby wrote:
>
> Hello fellow Ruby enthusiasts! 
>
> Although I've been using Ruby for some time, I just started using 
> RoR.  I'm experiencing an error that I'm having trouble resolving and 
> was hoping to find some help. 
>
> I am getting this error message when I try to hit a certain URL: 
>
> http://localhost:3000/captionfiles 
>
> NoMethodError in CaptionfilesController#index 
> undefined method `all' for Captionfile:Class 
> app/controllers/captionfiles_controller.rb:5:in `index' 
>
> Here are my files: 
>
> class CaptionfilesController < ApplicationController 
>   def index 
>     @captionfiles = Captionfile.all 
>
>     respond_to do |format| 
>       format.html # index.html.erb 
>       format.json { render json: @captionfiles } 
>     end 
>   end 
> ............. 
> class Captionfile < ActiveRecord::Base 
>   validates :title, :presence => true, :length => { :minimum => 2 } 
>   validates :filename, :presence => true 
>   has_many :run 
> end 
> ............ 
>
> Cccweb::Application.routes.draw do 
>   resources :captionfiles 
>   resources :runs 
>   get "pages/choose" 
>   get "home/index" 
>   get "runs/new" 
>   root :to => 'home#index' 
> end 
> ................. 
>
> I've searched the internets as well as many message bases, and 
> although I come up with variants of this message, none of the 
> solutions seem to help. 
>
> Thank you!

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/yNx82A1h-GYJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to