removed deprecated methods (mostly the ones prefixed with )

This commit is contained in:
Thorsten Böttger 2014-11-06 00:02:13 +01:00
parent 710790a03e
commit e9a7686b3e
5 changed files with 8 additions and 98 deletions

View File

@ -1,3 +0,0 @@
# Planned changes for AASM 4.0
* remove old aasm DSL (like `aasm_state`)

View File

@ -18,6 +18,7 @@
* **DSL change**: instance-based permissible_events has been removed in favor or events(:permissible => true) * **DSL change**: instance-based permissible_events has been removed in favor or events(:permissible => true)
* **DSL change**: class-based events now returns a list of Event instances (instead of a hash with event names as keys) * **DSL change**: class-based events now returns a list of Event instances (instead of a hash with event names as keys)
* **DSL change**: renamed permissible states and events to permitted states events * **DSL change**: renamed permissible states and events to permitted states events
* removed deprecated methods (mostly the ones prefixed with `aasm_`)
## 3.4.0 ## 3.4.0

7
PLANNED_CHANGES.md Normal file
View File

@ -0,0 +1,7 @@
# Planned changes for AASM 4.1
* remove support for `:on_transition` callback
# Planned changes for AASM 4.0
* nothing left

View File

@ -26,59 +26,6 @@ module AASM
@aasm @aasm
end end
# TODO remove this method in v4.0.0
def aasm_initial_state(set_state=nil)
if set_state
warn ".aasm_initial_state(:name) is deprecated and will be removed in version 4.0.0; please use .aasm.initial_state = :name instead!"
AASM::StateMachine[self].initial_state = set_state
else
warn ".aasm_initial_state is deprecated and will be removed in version 4.0.0; please use .aasm.initial_state instead!"
AASM::StateMachine[self].initial_state
end
end
# TODO remove this method in v4.0.0
def aasm_from_states_for_state(state, options={})
warn ".aasm_from_states_for_state is deprecated and will be removed in version 4.0.0; please use .aasm.from_states_for_state instead!"
aasm.from_states_for_state(state, options)
end
# TODO remove this method in v4.0.0
def aasm_initial_state=(state)
warn ".aasm_initial_state= is deprecated and will be removed in version 4.0.0"
AASM::StateMachine[self].initial_state = state
end
# TODO remove this method in v4.0.0
def aasm_state(name, options={})
warn ".aasm_state is deprecated and will be removed in version 4.0.0; please use .aasm.state instead!"
aasm.state(name, options)
end
# TODO remove this method in v4.0.0
def aasm_event(name, options = {}, &block)
warn ".aasm_event is deprecated and will be removed in version 4.0.0; please use .aasm.event instead!"
aasm.event(name, options, &block)
end
# TODO remove this method in v4.0.0
def aasm_states
warn ".aasm_states is deprecated and will be removed in version 4.0.0; please use .aasm.states instead!"
aasm.states
end
# TODO remove this method in v4.0.0
def aasm_events
warn ".aasm_events is deprecated and will be removed in version 4.0.0; please use .aasm.events instead!"
aasm.events
end
# TODO remove this method in v4.0.0
def aasm_states_for_select
warn ".aasm_states_for_select is deprecated and will be removed in version 4.0.0; please use .aasm.states_for_select instead!"
aasm.states_for_select
end
# aasm.event(:event_name).human? # aasm.event(:event_name).human?
def aasm_human_event_name(event) # event_name? def aasm_human_event_name(event) # event_name?
AASM::Localizer.new.human_event_name(self, event) AASM::Localizer.new.human_event_name(self, event)
@ -107,42 +54,6 @@ module AASM
true true
end end
# TODO remove this method in v4.0.0
def aasm_current_state
warn "#aasm_current_state is deprecated and will be removed in version 4.0.0; please use #aasm.current_state instead!"
aasm.current_state
end
# TODO remove this method in v4.0.0
def aasm_enter_initial_state
warn "#aasm_enter_initial_state is deprecated and will be removed in version 4.0.0; please use #aasm.enter_initial_state instead!"
aasm.enter_initial_state
end
# TODO remove this method in v4.0.0
def aasm_events_for_current_state
warn "#aasm_events_for_current_state is deprecated and will be removed in version 4.0.0; please use #aasm.events(aasm.current_state) instead!"
aasm.events(aasm.current_state)
end
# TODO remove this method in v4.0.0
def aasm_permissible_events_for_current_state
warn "#aasm_permissible_events_for_current_state is deprecated and will be removed in version 4.0.0; please use #aasm.events(:permitted => true) instead!"
aasm.events(:permitted => true)
end
# TODO remove this method in v4.0.0
def aasm_events_for_state(state_name)
warn "#aasm_events_for_state(state_name) is deprecated and will be removed in version 4.0.0; please use #aasm.events(state_name) instead!"
aasm.events(state_name)
end
# TODO remove this method in v4.0.0
def aasm_human_state
warn "#aasm_human_state is deprecated and will be removed in version 4.0.0; please use #aasm.human_state instead!"
aasm.human_state
end
private private
# Takes args and a from state and removes the first # Takes args and a from state and removes the first

View File

@ -39,12 +39,6 @@ module AASM
@transitions.select { |t| t.to == state } @transitions.select { |t| t.to == state }
end end
# TODO remove this method in v4.0.0
def all_transitions
warn "Event#all_transitions is deprecated and will be removed in version 4.0.0; please use Event#transitions instead!"
transitions
end
def fire_callbacks(callback_name, record, *args) def fire_callbacks(callback_name, record, *args)
# strip out the first element in args if it's a valid to_state # strip out the first element in args if it's a valid to_state
# #given where we're coming from, this condition implies args not empty # #given where we're coming from, this condition implies args not empty