Norbert Ryan
Norbert Ryan

Reputation: 81

Ruby on Rails namespace issue with iCalendar

i'm developing a calendar webapp for my company using ruby 1.8.7 and rails 2.3.8. naturally there are RoR models named "Calendar" and "Event".

in order to send calendar events to other apps (microsoft outlook & lotus notes) i'm integrating with the iCalendar standard & ruby library. http://icalendar.rubyforge.org/ but this library contains classes called "Calendar" and "Event"

now my app is getting lotta errors like this when it tries to use activerecord find - @calendar = Calendar.find(id) :

NoMethodError (undefined method find' for **Icalendar::Calendar:Class**): app/controllers/foos_controller.rb:184:insendEmailDialogForm' C:/Ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'

is there some way to do:

@calendar = ActiveRecord::Base.Calendar.find(id) ??

  or 

@calendar = appname.Calendar.find(id)

  or

@calendar = this.Calendar.find(id)

lazily trying to avoid using a module to specify a namespace or to rename my models.

Upvotes: 1

Views: 754

Answers (1)

Brian
Brian

Reputation: 6840

I'm thinking you have an include Icalendar somewhere. Try pulling that out & making your calls to that library using Icalendar::Calendar.new(...). This should take care of the namespace conflicts.

Upvotes: 2

Related Questions