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. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/0MIkLiCv5KEJ. For more options, visit https://groups.google.com/groups/opt_out.
<%= something %>, seems you miss a % @page is passed from controller to view as it is instance variable, so name should be same On Wed, Apr 24, 2013 at 1:48 AM, Kunal Patel <kunalppatel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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. > > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/0MIkLiCv5KEJ. > For more options, visit https://groups.google.com/groups/opt_out. > > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
there is error of % you can see, first try with scaffold that will help you lot On Thu, Apr 25, 2013 at 11:56 AM, William Herry <WilliamHerryChina-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> <%= something %>, seems you miss a % @page is passed from controller to > view as it is instance variable, so name should be same > > > On Wed, Apr 24, 2013 at 1:48 AM, Kunal Patel <kunalppatel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>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. >> >> >> -- >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To view this discussion on the web visit >> https://groups.google.com/d/msg/rubyonrails-talk/-/0MIkLiCv5KEJ. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On 23 April 2013 18:48, Kunal Patel <kunalppatel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.