Ok that made it work, but still doesn't make sense to me, there must be
something else wrong in my environment right?

Also to reference the class, I still needed to prefix the module name which
is also strange because I am requiring it!

Example:

require './mycar/car'

MyCar::Car.new  # this works
Car.new #didn't work

On Sun, Sep 23, 2012 at 5:46 PM, S Ahmed <sahmed1...@gmail.com> wrote:

> Why doesn't mine work, very confused??
>
> I've never seen that require in any gems on the web thought?
>
>
>
> https://github.com/ryanb/cancan/blob/master/lib/cancan.rb
>
>
> require 'cancan/ability'
>
> require 'cancan/rule'
>
> require 'cancan/controller_resource'
> require 'cancan/controller_additions'
>
> require 'cancan/model_additions'
>
> require 'cancan/exceptions'
>
> require 'cancan/inherited_resource'
>
>
> require 'cancan/model_adapters/abstract_adapter'
>
> require 'cancan/model_adapters/default_adapter'
>
> require 'cancan/model_adapters/active_record_adapter' if defined? ActiveRecord
>
> require 'cancan/model_adapters/data_mapper_adapter' if defined? DataMapper
>
> require 'cancan/model_adapters/mongoid_adapter' if defined?(Mongoid) && 
> defined?(Mongoid::Document)
>
>
>
>
>
> On Sun, Sep 23, 2012 at 5:42 PM, Everaldo Gomes 
> <everaldo.go...@gmail.com>wrote:
>
>> Hi. There is a typo, the correct is Module MyCar
>>
>> and try doing this: require './mycar/car'
>>
>> On Sun, Sep 23, 2012 at 6:29 PM, S Ahmed <sahmed1...@gmail.com> wrote:
>>
>>> I have a simple require call that is failing with:
>>>
>>> ruby mycar.rb
>>> /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
>>> `require': cannot load such file -- mycar/car (LoadError)
>>>  from
>>> /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
>>> `require'
>>> from mycar.rb:1:in `<main>'
>>>
>>> My file layout is:
>>>
>>> mycar.rb
>>> mycar/car.rb
>>>
>>> mycar.rb looks like:
>>>
>>> require 'mycar/car'
>>>
>>>
>>>
>>> car.rb looks like:
>>>
>>> modle MyCar
>>>   class Car
>>>   end
>>> end
>>>
>>>
>>> Why isn't this working, getting frustrated :(
>>>
>>> --
>>> 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 https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>  --
>> 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 https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>

-- 
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 https://groups.google.com/groups/opt_out.


Reply via email to