Class: ModelStub

Inherits:
ActiveRecord::Base show all
Defined in:
lib/six-updater-web/vendor/plugins/active_scaffold/test/model_stub.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ActiveRecord::Base

#associated_valid?, #no_errors_in_associated?, #save_associated, #save_associated!, #save_with_unsaved_flag, #to_label, #unsaved=, #unsaved?

Class Method Details

.a_authorized_for_bar?(user) ⇒ Boolean

column-level security methods, used for testing

Returns:

  • (Boolean)


33
34
35
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/model_stub.rb', line 33

def self.a_authorized_for_bar?(user)
  true
end

.b_authorized?(user) ⇒ Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/model_stub.rb', line 36

def self.b_authorized?(user)
  false
end

.columnsObject



24
25
26
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/model_stub.rb', line 24

def self.columns
  @columns ||= self.stubbed_columns.map{|c| ActiveRecord::ConnectionAdapters::Column.new(c.to_s, '') }
end

.columns_hashObject



28
29
30
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/model_stub.rb', line 28

def self.columns_hash
  @columns_hash ||= columns.inject({}) { |hash, column| hash[column.name.to_s] = column; hash }
end

Instance Method Details

#other_modelObject



13
14
15
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/model_stub.rb', line 13

def other_model
  @other_model || nil
end

#other_model=(val) ⇒ Object



10
11
12
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/model_stub.rb', line 10

def other_model=(val)
  @other_model = val
end

#other_modelsObject



20
21
22
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/model_stub.rb', line 20

def other_models
  @other_models || []
end

#other_models=(val) ⇒ Object



17
18
19
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/model_stub.rb', line 17

def other_models=(val)
  @other_models = val
end