Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sequel integration fix #350

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/state_machine/integrations/sequel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -416,13 +416,13 @@ def around_validation(*)
# Gets the db default for the machine's attribute
def owner_class_attribute_default
if owner_class.db.table_exists?(owner_class.table_name) && column = owner_class.db_schema[attribute.to_sym]
column[:default]
column[:ruby_default]
end
end

# Uses the DB literal to match the default against the specified state
def owner_class_attribute_default_matches?(state)
owner_class.db.literal(state.value) == owner_class_attribute_default
state.value == owner_class_attribute_default
end

# Creates a scope for finding records *with* a particular state or
Expand Down