Hi to Colin, Jennifer and anyone else,
If nothing else, this forum serves as a sanity check.
My difficulty arose when I created an application wide template as a
container for various views and attempted to pass a title variable to
the template. None of my fiddling raised any errors. After reading
your replies I went back to my application and sacrificed another hour
to Ruby idiosyncracies. Here is what I've done and the results.
#-------- within layout/application
class LinkController < ApplicationController
def display
@title = "title (display)"
end
def index
@title = "title (index)"
end
def foo
@title = "title (foo)"
end
end
----
<title><%= @title %></title>
---
I created a view named 'display' with the above embedded Ruby and
opened it in the browser. The title was BLANK.
Next I renamed the view 'index' and opened it in the browser. The
title appropriately showed "title (index)"
Then I renamed the view 'foo' and again a BLANK title.
I renamed the view back to 'index' and the title reappeared.
The above was with a template, so I decided to try the same fun
experiment with a standalone view. And things got murkier. Views
named 'index' and 'foo' display their titles. Views named 'display'
are BLANK.
Just on the off chance that Ruby is weirder than I think, I checked
the list of reserved words. No conflicts there. I also considered
there might be something bizarre about the title tags, so just stuck a
variable in the middle of the view <body> <@= @title %></body>. This
just reproduced the earlier results.
So there is the sad story. Help! I suppose I can just test all of my
view names to see if they pass muster, but I am really hoping to
eventually get to where Ruby is a time saver.
Any suggestions and/or comments on the instance variable behavior will
be welcomed.
Bill
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---