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

Using strings instead of symbols #48

Closed
sporto opened this issue May 9, 2012 · 1 comment
Closed

Using strings instead of symbols #48

sporto opened this issue May 9, 2012 · 1 comment

Comments

@sporto
Copy link

sporto commented May 9, 2012

If I try to use strings instead of symbols for defining the events Workflow doesn't work properly.

e.g.

state 'new' do
    event 'publish', ...
end

Then

object.can_publish? 

always returns false where it should return true. When using symbols this works fine.

However using string is useful for validation:

validates :state, :presence => true, :inclusion => STATUSES

where STATUSES is the array of possible valid states

When the object is first created the state is a symbol so validation passes. Then when the saved and retrieved back again state is a string so it doesn't validate anymore.

I would be good to have full support for using strings as well as symbols.

@voltechs
Copy link

Hmm... might be a neat idea to build validation into the workflow (active record adapter) (since that information is already available in the workflow_spec.

@geekq geekq closed this as completed May 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants