I’m new in RoR:)
I have controller and view (/app/controllers/greeting_controller.rb
and /app/views/greeting/index.rhtml /.erb/.html.erb - doesn’t match).
greeting_controller.rb source:
class GreetingController < ApplicationController
def index
@message = “Hello world!”
end
end
index.rhtml source:
test
<%= @message %>
and html output is exact copy of index.rhtml
- i’m working on macOS 10.6.4
please help!!))
Quoting Karen K. [email protected]:
I’m new in RoR:)
I have controller and view (/app/controllers/greeting_controller.rb
and /app/views/greeting/index.rhtml /.erb/.html.erb - doesn’t match).
You don’t say which version of Rails you are using, so I will assume
2.x. If
1.x or 3.x, ignore this reply.
greeting_controller.rb and index.rhtml look fine. But they are not
following
Rails naming conventions, controller names are plural, i.e.,
greetings_controller.rb and /app/views/greetings/. index.rhtml is old
style
naming, preferred current practice is index.html.erb. These two changes
may
be enough to solve your problem.
I don’t understand the last bit of the sentence above. Please expand
what you
mean by “/.erb/.html.erb - doesn’t match”. Do you mean that
/app/view/greeting/index.erb and /app/view/greeting/index.html.erb are
ignored
by the template engine?
HTH,
Jeffrey
I don’t understand the last bit of the sentence above. Please expand what
you
mean by “/.erb/.html.erb - doesn’t match”. Do you mean that
/app/view/greeting/index.erb and /app/view/greeting/index.html.erb are
ignored
by the template engine?
Yes!
It doesn’t make sense.
I’m using 2.x version.
Now controller name is Greetings, and view file name is index.html.erb
But the problem hasn’t been solved
2010/7/3 Fernando P. [email protected]
On 4 July 2010 21:40, Karen K. [email protected] wrote:
Now controller name is Greetings, and view file name is index.html.erb
But the problem hasn’t been solved
Please tell us the current filenames and contents again to make sure
of what you have done. Have you removed all the old files? Rails has
a habit of loading files that you have left lying around by accident.
What exactly is the symptom now seen?
Colin
rename /app/views/greeting/index.rhtml to …/index.html.erb
On 5 July 2010 09:42, Karen K. [email protected] wrote:
application_helper.rb
index.html.erb
index.html.erb
<%= @mes %>
html ouput (http://localhost:3000/greetings/
or http://localhost:3000/greetings/index/):
<%= @mes %>
Why it’s so hard?!
No bug report… Nothing…
Could you avoid top posting please, it makes it more difficult to
follow the thread.
What do you see in development.log?
Which version of rails are you using? You said 2.x but that covers a
lot of versions.
Colin
2010/7/6 Colin L. [email protected]
end
follow the thread.
Yes!
Colin
i’m using last version from rubyonrails.org
log:
[4;35;1mSQL (0.2ms) [0m [0mSET SQL_AUTO_IS_NULL=0 [0m
Processing GreetingsController#index (for 127.0.0.1 at 2010-07-05
12:41:42)
[GET]
Rendering greetings/index
Completed in 2ms (View: 1, DB: 0) | 200 OK [
http://localhost/greetings/index/]
app/
controllers/
application_controller.rb
greetings_controller.rb
helpers/
application_helper.rb
greetings_helper.rb
models/
photo.rb
views/
greetings/
index.html.erb
layouts/
greetings_controller.rb:
class GreetingsController < ApplicationController
def index
@mes = ‘test’
end
end
index.html.erb
<%= @mes %>
html ouput (http://localhost:3000/greetings/ or
http://localhost:3000/greetings/index/):
<%= @mes %>
Why it’s so hard?!
No bug report… Nothing…
2010/7/5 Colin L. [email protected]
config/routes.rb
map.connect ‘greeting’, :controller => ‘greeting’, :action => ‘index’
?
On 6 July 2010 07:51, Karen K. [email protected] wrote:
@mes = ‘test’
i’m using last version from rubyonrails.org
log:
[4;35;1mSQL (0.2ms) [0m [0mSET SQL_AUTO_IS_NULL=0 [0m
Processing GreetingsController#index (for 127.0.0.1 at 2010-07-05 12:41:42)
[GET]
Rendering greetings/index
Completed in 2ms (View: 1, DB: 0) | 200 OK
[http://localhost/greetings/index/]
I am out of ideas as to why the erb code is not being interpreted.
Anyone else?
Colin
On Jul 6, 9:09 am, Colin L. [email protected] wrote:
I am out of ideas as to why the erb code is not being interpreted. Anyone else?
Random guess: a stray invisible character somewhere in the file.
Fred
On Tue, Jul 6, 2010 at 10:13 AM, Karen K. [email protected]
wrote:
no
WTF?!
may be something wrong with macos 10.6.4 and current version of RoR?
What do you mean by “current”? 2.3.8, 3.0beta – which is it?
Do you have a small test case you can post somewhere?
FWIW, I’m running 2.3.8 at the moment on Mac OS 10.6.4 with no
problems. Other than self-inflicted ones, of course
–
Hassan S. ------------------------ [email protected]
twitter: @hassan
2010/7/6 Hassan S. [email protected]
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected][email protected]
.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
i’m using 1.3.7
On 7 July 2010 09:13, Karen K. [email protected] wrote:
i’m using 1.3.7
What? Do you mean rails 1.3.7? That is absolutely ancient, if it
ever existed at all. Do you mean 2.3.7? Type
rails -v
in your rails application directory to see what it is.
Colin
2010/7/6 Angel Robert M. [email protected]
app/
greetings_helper.rb
<%= @mes %>
What do you see in development.log?
I don’t understand the last bit of the sentence above. Please
It doesn’t make sense.
Colin
12:41:42) [GET]
.
.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
config/routes.rb
map.connect ‘greeting’, :controller => ‘greeting’, :action => ‘index’
?
no
WTF?!
may be something wrong with macos 10.6.4 and current version of RoR?
On Wed, Jul 7, 2010 at 3:36 PM, Frederick C.
<[email protected]
wrote:
can you dump the output you get after executing script/about in the
thread.
Regards,
Amiruddin N.,
On Jul 7, 9:13 am, Karen K. [email protected] wrote:
2010/7/6 Hassan S. [email protected]
i’m using 1.3.7
That seems unlikely - there never was a version 1.3.x of rails
(perhaps you’ve reported the version number of rubygems itself?)
Fred
hm…
ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
script/about
About your application’s environment
Ruby version 1.8.7 (universal-darwin10.0)
RubyGems version 1.3.7
Rack version 1.1
Rails version 2.3.8
Active Record version 2.3.8
Active Resource version 2.3.8
Action Mailer version 2.3.8
Active Support version 2.3.8
Application root /Library/WebServer/Documents/ruby_project_1
Environment development
Database adapter mysql
Database schema version 1
2010/7/8 Amiruddin N. [email protected]