On 23 April 2013 18:48, Kunal Patel <kunalppatel@gmail.com> wrote:
> I am using Learningrails.com tutorials and I am on lesson 10. I am having a
> few issues:
>
> 1) I cannot find a way to render the HTML tags. The method they used was
> insert in the controller/viewer_controller :
> class ViewerController < ApplicationController
> def show
> @page = Page.find_by_name(params[:name])
> end
> end
>
> and in the views/viewer/show.html.erb:
> <%= @pagethe.body > (*i get an error using this syntax, when i
> just input <%= @page > the page works but the HTML tags are still not
> rendered)
>
> I end up with a blank page with my layout still intact but no text, not even
> the text wrapped in a HTML tag.
>
> 2) I cannot find a way correctly shorten the URL. Their method was to insert
> in the routes.rb : view_page ':name', :controller => 'viewer', :action =>
> 'show'. But i keep getting an error "No route matches [GET] "/home"
>
> Can someone please help me?
>
> I am using rails 3.0; in the tutorial they are using an older method.
In that case you are doomed. To use a tutorial that is for a
different version of rails will lead to endless problems, you will
never know whether a problem you encounter is due to an error you have
made or a difference in rails. You must use the right version of
rails that the tutorial expects, but you should also use a tutorial
that is for rails 3. For example you could try railstutorial.org
which is free to use online.
Colin
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment