A few newbie questions about RoR

Hi,

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.

I hope you can help me.

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 D. 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.

Good luck!

Best regards,
Jorge Corona.

On Sep 4, 5:18 pm, Olivier P. [email protected]

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 D. 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).

On Sep 4, 3:18 pm, Olivier P. [email protected]

Hello Olivier,

One thing I noticed and no one else mentioned (I don’t like to duplicate
advice unnecessarily) is your controller should be
newsletters_controller.rb not just newsletter.rb. Here is something that
should get you going (but do take the advice of getting a book, and
Agile Web D. With Rails is a good one):

app/controllers/newsletters_controller.rb

class NewslettersController < ApplicationController
def newsletter
end
end

app/views/newsletters/newsletter.html.erb

This is our newsletter!

And you should be able to see that with
http://localhost:3000/newsletters/newsletter, assuming you are running
this on your local computer by way of script/server.

Now, this is not the best way of doing things, but this should at least
get you something to say “Ah”.

Peace,
Phillip

If you really want to learn it, best to do as the previous emails
mentioned: buy a book or read tutorials online

then, if I may add: do development on a local machine. Editing a live
app isn’t recommended and it’s more difficult to see errors there.

On Fri, Sep 5, 2008 at 4:42 PM, Olivier P.
[email protected] wrote:

@Phillip
@classname = “m2”

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 opacity: true
=> "Firstlink") %>
'Administratie', :action => 'database_entry' %>
  • <%= link_to 'Telefoonpermanentie', :controller =>
    • 'Marketing', :action => 'freelance_marketeer' %>
    'Dienstverleners' %>

  • Posted via http://www.ruby-forum.com/.


    Ramon T.

    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?

    @removed_email_address@domain.invalid
    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)

    class Nl::NieuwsbriefController < ApplicationController
    layout “nl”

    def index
    @menuitem = 1
    @classname = “m2”
    @pagetitle = “Firstlink - Nieuwsbrief”
    @description = “Nieuwsbrief Firstlink”
    @keywords = “nieuwsbrief”
    end

    end

    nl.rhtml (app/views/layouts/nl.rhtml)

    <%= @pagetitle %> <%= stylesheet_link_tag 'master' %> <%= javascript_include_tag "mootools-release-1.11.js" %> <%= javascript_include_tag "datepicker_nl.js" %> <%= javascript_include_tag "default.js" %> <%= yield :contact %>

    <% if @classname %>

    .<%= @classname %> { display: block;}

    <% end %>

    Firstlink

    Uw dienstenbedrijf voor secretariaat en marketing

    <%= link_to 'Login', :controller => 'Login' %>
    <%= image_tag("header_graphic.jpg", :alt => "Firstlink") %>
    • <%= link_to 'Home', :controller => 'Welkom' %>
    • Administratie
      • <%= link_to 'Database entry', :controller => 'Administratie', :action => 'database_entry' %>
    • Secretariaat
      • <%= link_to 'Freelance secretaresse', :controller => 'Secretariaat', :action => 'freelance_secretaresse' %>
      • <%= link_to 'Secretariaatsdiensten', :controller => 'Secretariaat', :action => 'secretariaatsdiensten' %>
      • <%= link_to 'Telefoonpermanentie', :controller => 'Secretariaat', :action => 'telefoonpermanentie' %>
      • <%= link_to 'Thuiskantoor', :controller => 'Secretariaat', :action => 'thuiskantoor' %>
      • <%= link_to 'Dictafoon transcriptie', :controller => 'Secretariaat', :action => 'dictafoon_transcriptie' %>
    • Vertaling
      • <%= link_to 'Vertaalwerk', :controller => 'Vertaling', :action => 'vertaalwerk' %>
      • <%= link_to 'Tolkwerk', :controller => 'Vertaling', :action => 'tolkwerk' %>
      • <%= link_to 'Verslaggeving', :controller => 'Vertaling', :action => 'verslaggeving' %>
    • Marketing
      • <%= link_to 'Mailing', :controller => 'Marketing', :action => 'mailing' %>
      • <%= link_to 'Telemarketing', :controller => 'Marketing', :action => 'telemarketing' %>
      • <%= link_to 'Televerkoop', :controller => 'Marketing', :action => 'televerkoop' %>
      • <%= link_to 'Copywriting', :controller => 'Marketing', :action => 'copywriting' %>
      • <%= link_to 'Freelance marketeer', :controller => 'Marketing', :action => 'freelance_marketeer' %>
      • <%= link_to 'Conferenties', :controller => 'Marketing', :action => 'conferenties' %>
      • <%= link_to 'Webdesign', :controller => 'Marketing', :action => 'webdesign' %>
      • <%= link_to 'Presentatie', :controller => 'Marketing', :action => 'presentatie' %>
      • <%= link_to 'Nieuwsbrief', :controller => 'Marketing', :action => 'nieuwsbrief' %>
      • <%= link_to 'Tevredenheidsenquête', :controller => 'Marketing', :action => 'tevredenheidsenquete' %>
    • <%= link_to 'Diensten', :controller => 'Diensten' %>
    • <%= link_to 'Info & Offerte', :controller => 'Info' %>
    • <%= link_to 'Toegevoegde waarde', :controller => 'Toegevoegde_waarde' %>
    • <%= link_to 'Referenties', :controller => 'Referenties' %>
    • <%= link_to 'Dienstverleners', :controller => 'Dienstverleners' %>
    • <% if not @home %>
    • <%= image_tag("vertical.jpg") %>
    • <% end %>
      <%= yield %>
    
    </div>
    <div id="twilight" class="clearfix">
      <ul id="lang">
        <li>Nl</li>
        <li><a href="/fr" title="Fran&ccedil;ais">Fr</a></li>
        <li><a href="/en" title="English">En</a></li>
      </ul>
      <%= yield :welcome %>
    </div>
    
    <%= link_to 'Sitemap', :controller => 'Sitemap' %> | <%= link_to 'Contacteer ons', :controller => 'Contact' %>
    Copyright © <%= Time.now.year %> Firstlink

    index.rhtml (app/views/nl/nieuwsbrief/index.rhtml)

    Nieuwsbrief tekst

    PS: Nieuwsbrief is Newsletter in dutch, these 3 pages uses exactly the
    same structure as the other site pages.

    OK, I will buy a book and setup a development server.

    But can I after I’ve setup the server just simple copy the current ftp
    site directory directly on my server?