1

I am implementing something like an e signature.

User fills a form in multiple steps (I keep storing information in the session) and in the last step I save the form. However, on the last steps I've added a textfield in which the user should enter their name. The name they enter in this textfield must match the one in session[:fullname] or the validation should fail.

What is the best way to achieve this? I want to avoid accessing session inside the model.

Omnipresent
  • 29,434
  • 47
  • 142
  • 186
  • maybe model is exactly where it fits? http://weblog.jamisbuck.org/2006/10/18/skinny-controller-fat-model – Imre L May 20 '11 at 19:02
  • I'm going by this, frowning on accessing session inside the model: http://m.onkey.org/how-to-access-session-cookies-params-request-in-model – Omnipresent May 20 '11 at 19:04

1 Answers1

0

So how do you get it into session in first place?

if you do it in controller then pass the value to model from controller :D

Looks like you got the solution on your own.

Imre L
  • 6,159
  • 24
  • 32
  • I'm close ... :). can a value be passed to a `validate` method from the controller? `def validate(namefromsession) if signature != namefromsessionerrors.add(:signature, "not same") end` guess i should try that. – Omnipresent May 20 '11 at 19:26