class_inheritable_accessor -> class_attribute

refs CNVS-9166

Change-Id: Ie116881aaeae201222a658de1eb5fc608cec7d01
test-plan: N/A
Reviewed-on: https://gerrit.instructure.com/25726
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
This commit is contained in:
Jacob Fugal 2013-10-28 15:21:23 -06:00
parent 8db092c481
commit a7f4549500
3 changed files with 26 additions and 7 deletions

View File

@ -107,8 +107,13 @@ class WebConference < ActiveRecord::Base
user_setting_fields[name] = options
end
def self.user_setting_fields
read_inheritable_attribute(:user_setting_fields) || write_inheritable_attribute(:user_setting_fields, {})
if CANVAS_RAILS2
def self.user_setting_fields
read_inheritable_attribute(:user_setting_fields) || write_inheritable_attribute(:user_setting_fields, {})
end
else
class_attribute :user_setting_fields
self.user_setting_fields = {}
end
def self.user_setting_field_name(key)
@ -133,8 +138,13 @@ class WebConference < ActiveRecord::Base
send("#{key}_external_url", user, url_id) || []
end
def self.external_urls
read_inheritable_attribute(:external_urls) || write_inheritable_attribute(:external_urls, {})
if CANVAS_RAILS2
def self.external_urls
read_inheritable_attribute(:external_urls) || write_inheritable_attribute(:external_urls, {})
end
else
class_attribute :external_urls
self.external_urls = {}
end
def self.external_url(name, options)

View File

@ -20,7 +20,11 @@ module SendToInbox
module SendToInboxClassMethods
def self.extended(klass)
klass.send(:class_inheritable_accessor, :send_to_inbox_block)
if CANVAS_RAILS2
klass.send(:class_inheritable_accessor, :send_to_inbox_block)
else
klass.send(:class_attribute, :send_to_inbox_block)
end
end
def on_create_send_to_inboxes(&block)

View File

@ -19,8 +19,13 @@
module SendToStream
module SendToStreamClassMethods
def self.extended(klass)
klass.send(:class_inheritable_accessor, :send_to_stream_block)
klass.send(:class_inheritable_accessor, :send_to_stream_update_block)
if CANVAS_RAILS2
klass.send(:class_inheritable_accessor, :send_to_stream_block)
klass.send(:class_inheritable_accessor, :send_to_stream_update_block)
else
klass.send(:class_attribute, :send_to_stream_block)
klass.send(:class_attribute, :send_to_stream_update_block)
end
klass.has_one :stream_item, :as => :asset
end