Hey all, I''m rather new to rails, but I do have a Rails 2.0 project up and running. Now I want to add a new view, let''s call it "newpage" and it has a link from my main page called "index.html.erb" <b><%= link_to ''New Page'', :action=> "newpage" %></b> I assume i''ll need a file called "newpage.html.erb" in my project "views" folder, and i''ll need a method in my <project>_controller.rb file called "newpage". Currently, it looks like this, but its not working: def newpage end Anybody know what i''m missing? Do I need some other code in there? All I want to do at this point is display a simple page, so I assume I don''t need anything in the method or do I? Any help would be appreciated. Dave --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> I''m rather new to rails, but I do have a Rails 2.0 project up and > running. Now I want to add a new view, let''s call it "newpage" and it > has a link from my main page called "index.html.erb" > > <b><%= link_to ''New Page'', :action=> "newpage" %></b>Is your :index and :newpage in the same controller? If not you need to tell the link above what controller to use.> I assume i''ll need a file called "newpage.html.erb" in my project > "views" folder, and i''ll need a method in my <project>_controller.rb > file called "newpage". Currently, it looks like this, but its not > working: > > def newpage > > endIf it''s just a view you don''t even need the method declaration. Doesn''t hurt though. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
def newpage send_data(#{RAILS_ROOT}/app/views/index.rhtml.erb) end I advice you to put your index.rhtml.erb in public folder. Hope it can answer your problem. Ref: http://railsmanual.org/module/ActionController::Streaming?method=send_data ~*~*~*~*~*~*~*~*~*~*~*~*~ Reinhart Ariando YM : Booking2Heaven Web: teapoci.blogspot.com ~*~*~*~*~*~*~*~*~*~*~*~*~ -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---