Hi, I''m a complete beginner and I just have a simple question: How do I change lines in a file like routes.rb? I know the command type (i.e type config\routes.rb) but that just shows it and doesn''t allow me to change anything. Thanks in advance -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 7 May 2011, at 18:39, "Mohamed L." <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hi, > > I''m a complete beginner and I just have a simple question: > How do I change lines in a file like routes.rb? I know the command type > (i.e type config\routes.rb) but that just shows it and doesn''t allow me > to change anything.Use your favourite text editor Fred> > Thanks in advance > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thankyou. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hey, I''m trying to sort out the routing still, I''ve generated a home controller, deleted the public/index.html and changed the routes.rb to have :root to=> "home#index" and I have changed the html code in app\view\home\index When I open it I keep getting: Routing Error No route matches "/" -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sat, May 7, 2011 at 9:27 PM, Mohamed L. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hey, I''m trying to sort out the routing still, I''ve generated a home > controller, deleted the public/index.html and changed the routes.rb to > have :root to=> "home#index" and I have changed the html code in > app\view\home\index > > When I open it I keep getting: Routing Error No route matches "/" >Hmmm it sounds like you might be getting sent elsewhere. Is there anotehr :root entry in your routes? As well, do you have both an home/index.html.erb view as well as an index action in your controller? Also, is there any other code you have added to the app such as in the application controller which might be redirecting you?> > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 8 May 2011 03:27, Mohamed L. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hey, I''m trying to sort out the routing still, I''ve generated a home > controller, deleted the public/index.html and changed the routes.rb to > have :root to=> "home#index" and I have changed the html code in > app\view\home\indexIt should just be root, not :root so root :to => "home#index" Colin> > When I open it I keep getting: Routing Error No route matches "/" > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
David Kahn wrote in post #997316:> On Sat, May 7, 2011 at 9:27 PM, Mohamed L. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > >> Hey, I''m trying to sort out the routing still, I''ve generated a home >> controller, deleted the public/index.html and changed the routes.rb to >> have :root to=> "home#index" and I have changed the html code in >> app\view\home\index >> >> When I open it I keep getting: Routing Error No route matches "/" >> > > Hmmm it sounds like you might be getting sent elsewhere. Is there > anotehr > :root entry in your routes? As well, do you have both an > home/index.html.erb > view as well as an index action in your controller? Also, is there any > other > code you have added to the app such as in the application controller > which > might be redirecting you?In the home controller I have: class HomeController < ApplicationController def index end end Thanks -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 8 May 2011 12:31, Mohamed L. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> David Kahn wrote in post #997316: >> On Sat, May 7, 2011 at 9:27 PM, Mohamed L. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> >>> Hey, I''m trying to sort out the routing still, I''ve generated a home >>> controller, deleted the public/index.html and changed the routes.rb to >>> have :root to=> "home#index" and I have changed the html code in >>> app\view\home\index >>> >>> When I open it I keep getting: Routing Error No route matches "/" >>> >> >> Hmmm it sounds like you might be getting sent elsewhere. Is there >> anotehr >> :root entry in your routes? As well, do you have both an >> home/index.html.erb >> view as well as an index action in your controller? Also, is there any >> other >> code you have added to the app such as in the application controller >> which >> might be redirecting you? > > In the home controller I have: > > class HomeController < ApplicationController > def index > endIt is nothing to do with the controller, it is saying there is no route. That is before it even looks for a controller. Did you try root :to => instead of :root to => as I suggested? Don''t forget to restart the server after changing routes.rb. It is interpreted when the app is first loaded. If it is still not working post your routes.rb file here. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Yeah I had changed to root :to=> and restarted the server. Ok, my routes.rb Debate::Application.routes.draw do resources :posts get "home/index" # The priority is based upon order of creation: # first created -> highest priority. # Sample of regular route: # match ''products/:id'' => ''catalog#view'' # Keep in mind you can assign values other than :controller and :action # Sample of named route: # match ''products/:id/purchase'' => ''catalog#purchase'', :as => :purchase # This route can be invoked with purchase_url(:id => product.id) # Sample resource route (maps HTTP verbs to controller actions automatically): # resources :products # Sample resource route with options: # resources :products do # member do # get ''short'' # post ''toggle'' # end # # collection do # get ''sold'' # end # end # Sample resource route with sub-resources: # resources :products do # resources :comments, :sales # resource :seller # end # Sample resource route with more complex sub-resources # resources :products do # resources :comments # resources :sales do # get ''recent'', :on => :collection # end # end # Sample resource route within a namespace: # namespace :admin do # # Directs /admin/products/* to Admin::ProductsController # # (app/controllers/admin/products_controller.rb) # resources :products # end # You can have the root of your site routed with "root" # just remember to delete public/index.html. # root :to => "home#index" # See how all your routes lay out with "rake routes" # This is a legacy wild controller route that''s not recommended for RESTful applications. # Note: This route will make all actions in every controller accessible via GET requests. # match '':controller(/:action(/:id(.:format)))'' end Thanks -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 8 May 2011 13:46, Mohamed L. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Yeah I had changed to root :to=> and restarted the server. > > Ok, my routes.rb> > Debate::Application.routes.draw do > resources :posts > ... > # You can have the root of your site routed with "root" > # just remember to delete public/index.html. > # root :to => "home#index"Unfortunately you have it commented out. Remove the #> > # See how all your routes lay out with "rake routes"Take note of this. You can run rake routes to see what routes you have defined. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 8 May 2011 13:52, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 8 May 2011 13:46, Mohamed L. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> Yeah I had changed to root :to=> and restarted the server. >> >> Ok, my routes.rb>> >> Debate::Application.routes.draw do >> resources :posts >> ... >> # You can have the root of your site routed with "root" >> # just remember to delete public/index.html. >> # root :to => "home#index" > > Unfortunately you have it commented out. Remove the #That''s ok, don''t mention it. Oh you didn''t, never mind. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
it worked ofcourse. Thanks again. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.