Module: Cell::VersionStrategy::ClassMethods

Defined in:
lib/cell/rails3_0_strategy.rb,
lib/cell/rails3_1_strategy.rb

Instance Method Summary collapse

Instance Method Details

#cell_nameObject



36
37
38
# File 'lib/cell/rails3_0_strategy.rb', line 36

def cell_name
  controller_path
end

#find_class_view_for_state(state) ⇒ Object

Returns all possible view paths for state by invoking #view_for_state on all classes up the inheritance chain.



30
31
32
33
34
# File 'lib/cell/rails3_0_strategy.rb', line 30

def find_class_view_for_state(state)
  return [view_for_state(state)] unless superclass.respond_to?(:find_class_view_for_state)

  superclass.find_class_view_for_state(state) << view_for_state(state)
end

#view_context_classObject



14
15
16
17
18
19
20
21
# File 'lib/cell/rails3_0_strategy.rb', line 14

def view_context_class
  @view_context_class ||= begin
    Class.new(Cell::Rails::View).tap do |klass|
      klass.send(:include, _helpers)
      klass.send(:include, _routes.url_helpers)
    end
  end
end

#view_for_state(state) ⇒ Object

Return the default view path for state. Override this if you cell has a differing naming style.



24
25
26
# File 'lib/cell/rails3_0_strategy.rb', line 24

def view_for_state(state)
  "#{cell_name}/#{state}"
end