I am new to RoR.
I just download some sample codes and deploy the app.
After that, I get error message as follows:
undefined method `url' for nil:NilClass
Extracted source (around line #5):
2:
3: <p>
4: <b>Url:</b>
5: <%= @page.url %>
6: </p>
7:
And the corresponding codes in pages_controller.rb is
def index
@pages = Page.all
respond_with(@pages)
end
Is there any suggestion for handling this error?
Thanks
Elaborating on @Lakitu’s answer a bit, you should have something like this in your index view:
Don’t know why scaffolding produced this issue, but the root cause is very well explained by @Lakitu (+1 for that).