my website is developed by a webdesign office, but now I want to be able
to change the website myself. I've knowledge about php and html but I'm
new to RoR.
So now I want to create a new page on our site, but I don't know how to
do this. This is what I tried:
-I've manually wrote a controller (newsletter.rb)and placed it in the
controller folder
-I've wrote the newsletter.rhtml (in the newsletter folder that is
stored in the views folder)
But when I try to open the page on IE, I get a 404 error.
I used the same structure that the other pages uses.
Without seeing the code this is just a wild guess, but the first place
I'd look would be config/routing.rb. That's the file that controls
which requests go to which controllers - assuming your controller is
valid, the 404 says the request never got to it.
I strongly suggest that you spend some quality time on a RoR beginners
tutorial before you adventure without a clear map of where are you
going.
I also highly recommend to buy the Agile Web Development with Rails
from David Thomas and do the tutorial on the first part.
Is not that I can't help you, is that your question is so basic, that
I know you haven't read (and practice) a basic beginners tutorial.
Look for one of the many blog creation tutorial with rails also. That
should give you enough knowledge to start modifying you site.
Also as a wild guess, he needs an action called as the template, as a
minimum.
It seems that this is the problem. (again, without looking at the
code).
your controller isn't looking for newsletter.rhtml. It's looking for
an action, such as show.rhtml. Also, if you're using a more recent
version of rails, it's probably looking for show.html.erb (rhtml seems
to be out of favor). Definitely buy the Agile Web Development book
(there's a 3rd edition in development right now--make sure you get the
beta PDF of that; the 2nd edition is pretty outdated now).
I've already read several RoR tutorials, but they are all talking about
a server that is on your local machine. And I don't know how to use the
rails generate command on my webhosting. Or is it allowed to write the
controller manually?
@jeffpatterson@gmail.com
Our website is only 1 month old, and the webdesign office use .rhtml for
everything.
@Phillip
I've done exactly what you've told me but I still got the 404 error.
Here are the codes of the pages:
nieuwsbrief_controller.rb (app/controllers/nl/nieuwsbrief_controller.rb)