Hello!
I'm fairly new to coding the rails stuff - I'm however a webdesigner and I feel that I need to learn how to break rails apart once and for all.
So I've spent roughly 3 hours on trying to do this on my own but with no success.
My information:
Rails -v = 3.0.0 Ruby -v = 1.8.7 Gem -v = 1.3.7 haml -v = 3.0.25 postgresql 9.0
My goal:
Make some kind of blog-function so I fill in a text_area in a form and when I hit the submit button I want the server to create a file in let's say public/comments. So here comes an example so you will get me 100%.
Me as an administrator makes a post through code. I use javascript to count the amount of post classes so I know what ID to give the next comment for the new file name. and then I make the form where the text_area is at and where the submit button is. so the first post which I wrote with code will have something looking like this:
<script type="text/javascript" src="public/comments/2011_03_1.js"></script> 2011_03 being the ID of the article and the 1 being the ID of the comment.
then when someone comments through the form the 2011_03_1.js file is being made in public/comments so the link only works untill someone has made a post - if not it includes a file that does not exist.
however. in this new file it should say something like this:
document.write('<div class="comment 2011_03">'); //Div to count the messages so JS knows what the next ID is document.write('<h1>USER says:</h1>'); //user ID says document.write('Oh man this blog is epic! wooah!'); //random comment text document.write('</div>'); document.write('<script type="text/javascript" src="public/comments/2011_03_2.js"></script>') //link to the ID #2
and then it goes on - chained. the downside by using this method is that if you need to delete one at the early places then you need to modify everything behind it because of how this system works - but I'm fine with that.
so the only thing I want to know now is someone pointing me in to the right direction for this method: you fill in a text_form and on the serverside a file is being made which is being filled with information such as the above. I've been googling quite a bit about routing and I did not really understand it. same thing with the controller and the model.. I didn't.. quite get it.. I did my best at understanding it but I only got mumbo jumbo. So once again - I'm deeply grateful if anyone can point me to either the right direction or to some code with information on it(without works too) so I can for once finally learn!
and I am not sure if I was supposed to do a 'rake db/migrate' once I was done with the controller / model / routing files.. I know squat hmm
Thanks in advance -abandoned