On 13 March 2012 17:36, AndyLikesRuby <usbd...@gmail.com> wrote:
> Hi Colin,
>
> I did try restarting the server, etc.  I still can't fix the problem.

You did not say whether you can do anything useful with the class at
all (probably because you top posted rather than inserting comments
inline).   This would have told us whether it is something specific to
do with #all or whether your class is not being recognised as an
ActiveRecord class.

Colin

>
> I am going to do some deep-diving into the code today.  I suspect it
> has something to do with a file like routes.db, or similar.  The code
> seems to be ok -- there's something else that isn't quite evident
> that's causing this issue.
>
> Thanks for your help!
>
> Andy
>
> On Mar 11, 2:49 pm, Colin Law <clan...@googlemail.com> wrote:
>> On 9 March 2012 19:52, AndyLikesRuby <usbd...@gmail.com> 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
>>
>> Can you do anything useful with the Captionfile class?  Creating
>> records for example.
>>
>> I assume you have you tried restarting the server.
>>
>> Are you sure you have not got Captionfile declared in another file
>> somewhere?  Perhaps you kept a copy of captionfiles.rb with an out of
>> date definition in it.  Do a global source search for Captionfile in
>> your project.
>>
>> That should be has_many :runs by the way (plural) but I don't think
>> that is anything to do with this problem.
>>
>> Colin
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> 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.
>



-- 
gplus.to/clanlaw

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
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