Ruby on Rails Sunday, June 8, 2014

IMHO, strictly binding data with controller is *not* a good mindset,
even if in this case separate login and dict creation makes more sense,
especially for the "open a dict" feature.

However, just for fun and experimentation, one possible solution to keep
the old UI design could be this:
- Using reform (https://github.com/apotonick/reform), create 2 form: one
for Login and one for Dict, so we can separate the business logic and
validations.
- Create a workflow object to isolate Dict open and creation
- In login controller, check data validation and perform the workflow
accordingly.
- In dict controller, just use the workflow object

I've done a code example here: http://codeshare.io/tkL5n (but again,
take this only as an exercise)
I've not personally checked if it has errors, but it logically works.

Try to not think too much in term of Model<->Controller and remember
that ruby is an OO language, where even a simple number is an instance!

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/6de94b5ad1effc085a1424007474cf26%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment