[Radiant] custom controllers displaying a page from radiant
orff
proudestmonkey at gmail.com
Thu Oct 12 18:11:43 CDT 2006
I would love to just be able to call methods in my own custom controller to
display the CMS content, but do things like form handling / database
interaction using rails proper and not have to write behaviors to add
functionality. I have successfully written my own behavior based off of the
mailer behavior to submit form data to a model, but the whole time what I
really wanted to do was just display a certian page from the CMS with my own
forms / validation / etc happening as rails code.
I played around with a new controller on my dev version calling render with
an injected page part, but could not get it to work without committing the
page part to the database first. I have since deleted it, but the code was
similar to this (sorry, I dont have the exact code, but I think you can get
the idea)
def index
@page = Page.find(1)
custom_content = render_partial 'some_partial'
@page.page_parts << PagePart.new( :name=>'form',
:content=>custom_content )
process_page # this is the part I really cant remember, it was three
lines or so of code
end
Is there anyone from the development team that could give me a hint as to
how to do this, or convince me that custom controllers are a really bad idea
and I should just write behaviors ? I understand fully there are lots of
things that can do wrong with modifying the page real-time, but it would be
nice to just do my forms in rails with validations, activerecord
relationships, etc. etc.
Debugging behaviors is a real pain because I keep having to re-start my web
server to see new results (even in development mode). Maybe if someone can
tell me how to fix just this problem I'd be a little more happy to write
behaviors.
-mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.radiantcms.org/pipermail/radiant/attachments/20061012/21ce5a65/attachment.html
More information about the Radiant
mailing list