# Error in View

**URL:** <https://www.ruby-forum.com/t/error-in-view/141049>\
**Category:** Rails\
**Created:** [June 21, 2008, 9:05am UTC](https://www.ruby-forum.com/t/error-in-view/141049 "2008-06-21T09:05:08Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ashit\_V](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/41988e/32.png) [@Ashit\_V](https://www.ruby-forum.com/u/Ashit_V)\
**Post date:** [June 21, 2008, 9:05am UTC](https://www.ruby-forum.com/t/error-in-view/141049/1 "2008-06-21T09:05:08Z")

</div>

Hello,  
'm new to RoR.  
I was facing one prob and 'm unable to figure out my mistake. can  
anyone pls help me?

the error is

* * *

SyntaxError in Pages#index

Showing pages/index.html.erb where line #4 raised:

compile error  
C:/rails/railscoder/app/views/pages/index.html.erb:4: dynamic constant  
assignment  
\_erbout.concat “\t”; @pages.each do |Page| ; \_erbout.concat “\n”  
^

Extracted source (around line #4):

1:

## All Pages
  
2:  
3: 
  
4: \<% @pages.each do |Page| %\>  
5: -   
6: \<%= Page.permalink %\> :\<%= Page.title s%\>  
7: 

Trace of template inclusion: /pages/index.html.erb

RAILS\_ROOT: C:/rails/railscoder

* * *

One thing that confuses me alot is… does view file have  
extension .rhtml or .html.erb ???

Any help is highly appreciated.  
Thanks  
-Ashit V.

---

<div class="post-metadata">

**Author:** ![Ashit\_V](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/41988e/32.png) [@Ashit\_V](https://www.ruby-forum.com/u/Ashit_V)\
**Post date:** [June 21, 2008, 9:17am UTC](https://www.ruby-forum.com/t/error-in-view/141049/2 "2008-06-21T09:17:26Z")

</div>

put  
\<%end%\>

---

<div class="post-metadata">

**Author:** ![Ashit\_V](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/41988e/32.png) [@Ashit\_V](https://www.ruby-forum.com/u/Ashit_V)\
**Post date:** [June 21, 2008, 9:22am UTC](https://www.ruby-forum.com/t/error-in-view/141049/3 "2008-06-21T09:22:42Z")

</div>

Still the same error…  
May I know, Can the extension of View file be _.html.erb_ ???  
I heard that it should be ._rhtml._ But in my case rails auto generated  
it  
with extension _.html.erb_

On Sat, Jun 21, 2008 at 12:16 AM, bala kishore pulicherla \<  
removed\_email\_address@domain.invalid\> wrote:

> > \_erbout.concat “\t”; @pages.each do |Page| ; \_erbout.concat “\n”  
> > 7:
> > 
> > Any help is highly appreciated.  
> > Thanks  
> > -Ashit V.
> 
> >

–  
Ashit V.

Yahoo: vora\_ashit  
Gtalk: a.k.vora  
Skype: ashit.vora

“It is futile to be overconfident about your ability. Exercise caution  
wherever necessary.”

---

<div class="post-metadata">

**Author:** ![Ashit\_V](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/41988e/32.png) [@Ashit\_V](https://www.ruby-forum.com/u/Ashit_V)\
**Post date:** [June 21, 2008, 9:42am UTC](https://www.ruby-forum.com/t/error-in-view/141049/4 "2008-06-21T09:42:37Z")

</div>

whn u use scaffold rails auto generate the view files with the extension  
.html.erb  
it can be either .rhtml or html.erb

the problem is with the variable that ur using ☹  
u can’t use Page bcz itz a key word  
for ex request,Page,response … (these are the key words so u cant  
use  
them)

change ur variable name to page or some thing else

---

<div class="post-metadata">

**Author:** ![Ashit\_V](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/41988e/32.png) [@Ashit\_V](https://www.ruby-forum.com/u/Ashit_V)\
**Post date:** [June 21, 2008, 9:43am UTC](https://www.ruby-forum.com/t/error-in-view/141049/5 "2008-06-21T09:43:47Z")

</div>

* * *

Controller

class PagesController \< ApplicationController

def index  
@pages = Page.find (:all)  
end  
end

View

## All Pages

 \<% @pages.each do |Page| %\> - \<%= Page.title %\> 
 \<% end %\>

I donno why the View is named index.html.erb (instead of index.rhtml)

* * *

Thanks

On Jun 21, 12:16 am, “bala kishore pulicherla” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Ashit\_V](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/41988e/32.png) [@Ashit\_V](https://www.ruby-forum.com/u/Ashit_V)\
**Post date:** [June 21, 2008, 9:46am UTC](https://www.ruby-forum.com/t/error-in-view/141049/6 "2008-06-21T09:46:42Z")

</div>

did u get fixed??

---

<div class="post-metadata">

**Author:** ![Ashit\_V](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/41988e/32.png) [@Ashit\_V](https://www.ruby-forum.com/u/Ashit_V)\
**Post date:** [June 21, 2008, 9:47am UTC](https://www.ruby-forum.com/t/error-in-view/141049/7 "2008-06-21T09:47:53Z")

</div>

Yea, I was able to fix the error…  
The prob was with variable name(Page) as u said.  
Thanks again.

---

<div class="post-metadata">

**Author:** ![Ashit\_V](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/41988e/32.png) [@Ashit\_V](https://www.ruby-forum.com/u/Ashit_V)\
**Post date:** [June 21, 2008, 9:46am UTC](https://www.ruby-forum.com/t/error-in-view/141049/8 "2008-06-21T09:46:42Z")

</div>

Hurre…  
Changing Page to page worked…  
Thanks alot… 🙂
