Hi all,
I have been using Adva Cms full time for a week now and I'm very happy
about it. Even without extensive documentation it is fairly easy to
understand the concepts for an experienced Rails developer. One of
things I haven't grasped completely is how cells should be used in
Adva. I have read the earlier write up on cells [1], the wiki, even
the Readme and examples of the Rails Cell gem itself. Unfortunately,
one case seems unclear to me.
One of the requirements of the site I'm building is a contact form
that can handle attachments and gives validations errors for required
fields. I took the adva contact form implementation as an example. The
first version without validation was quite simple. The form would have
to post to a controller and the user would be redirected to the page
after sending the email, just like the example in Adva. However when I
needed to add the validation logic it became more complex. I now had
to redirect back to the page with the parameters and validation
errors.
So I decided to tackle this problem differently and I used the Rails
Cell as a full controller (how it is supposed to be?). So the form now
posts to the current url and it uses a parameter to tell the cell
which action is next. It feels cleaner than the earlier implentation.
One thing I'm uncertain about is that I need to fake a GET method by
adding hidden field "_method" with value "get". Otherwise the user
isn't redirected to the show (article) action.
What do you think? How do you solve these kind of problems?
You can find a part of the implementation here:
http://gist.github.com/253612
Cheers,
Jeroen
[1]
http://groups.google.com/group/adva-cms/msg/2ba256b8b20cc1d0?hl=en