model :my_model
Is the correct usage. All the methods work this way. You aren''t really
specifying the file name, but I think a literal that can be used to
determine the class name in a given context. For example:
class MyModelBox < ActiveRecord::Base
has_many :my_models
end
class MyModel < ActiveRecord::Base
belongs_to :my_model_box
end
Jack Christensen wrote:
> Please excuse yet another newbie question...
>
> I''m getting this error:
>
> MissingSourceFile in <controller not set>#<action not set>
>
> c:/program
>
files/ruby/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/action_controller/dependencies.rb:75:in
> `require_dependencies'': Missing model MyModel.rb
>
> From these lines of code:
>
> class MyModelController < ApplicationController
> model :MyModel
> end
>
> The model''s file name is my_model.rb. If I rename the file to
> MyModel.rb it works, or if I change the line of code to model
> :my_model it works. I used the generator for the model so it seems
> that the file name should follow rails conventions. But it seems that
> the model method of ApplicationController is looking for a file name,
> rather than a class name. Am I missing something here or do I have to
> pass the file name to model?
>
> Thanks!
>
> Jack Christensen
>
>
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
>