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”
<%= link_to ‘New Page’, :action=> “newpage” %>
I assume i’ll need a file called “newpage.html.erb” in my project
“views” folder, and i’ll need a method in my _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
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”
<%= link_to ‘New Page’, :action=> “newpage” %>
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 _controller.rb
file called “newpage”. Currently, it looks like this, but its not
working:
def newpage
end
If it’s just a view you don’t even need the method declaration. Doesn’t
hurt though.
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
~~~~~~~~~~~~~