ruby 1.9.1 & Rails 2.3.4 generate code show wrong .

11 views
Skip to first unread message

ouwsh

unread,
Sep 24, 2009, 6:16:12 AM9/24/09
to Ruby on Rails: Talk
My computer build on windows Ruby 1.9.1 ,rails 2.3.4 mysql

I am follow agile_web_development_with_rails_3rd_edition book to build
my site

ruby script/generate scaffold recipe title:string author:string
description:text

rake db:migrate

when I use chrome to view the url : http://192.168.15.100:3000/recipes

It shows this mistake:

NoMethodError in Recipes#index
Showing app/views/layouts/recipes.html.erb where line #12 raised:

undefined method `^' for "a":String

Extracted source (around line #12):

9: </head>
10: <body>
11:
12: <p style="color: green"><%= flash[:notice] %></p>
13:
14: <%= yield %>
15:

RAILS_ROOT: E:/ror


and then I try :http://192.168.15.100:3000/recipes/new


It shows this :

NoMethodError in Recipes#new
Showing app/views/recipes/new.html.erb where line #3 raised:

undefined method `^' for "a":String

Extracted source (around line #3):

1: <h1>New recipe</h1>
2:
3: <% form_for(@recipe) do |f| %>
4: <%= f.error_messages %>
5:
6: <p>



RAILS_ROOT: E:/ror


the Log file record is :

Processing RecipesController#new (for 192.168.15.100 at 2009-09-24
15:43:46) [GET]
[4;35;1mRecipe Columns (0.0ms) [0m [0mSHOW FIELDS FROM `recipes`
[0m
Rendering template within layouts/recipes
Rendering recipes/new

ActionView::TemplateError (undefined method `^' for "a":String) on
line #3 of app/views/recipes/new.html.erb:
1: <h1>New recipe</h1>
2:
3: <% form_for(@recipe) do |f| %>
4: <%= f.error_messages %>
5:
6: <p>

(eval):2:in `form_authenticity_token'
app/views/recipes/new.html.erb:3
app/controllers/recipes_controller.rb:29:in `new'
<internal:prelude>:8:in `synchronize'
C:/Ruby/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
C:/Ruby/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
C:/Ruby/lib/ruby/1.9.1/webrick/server.rb:183:in `block in
start_thread'

Rendered rescues/_trace (125.0ms)
Rendered rescues/_request_and_response (0.0ms)
Rendering rescues/layout (internal_server_error)


btw i try ruby 1.8.6 + rails 2.3.4 is ok.thanks very much for your
time.

Frederick Cheung

unread,
Sep 24, 2009, 7:45:43 AM9/24/09
to Ruby on Rails: Talk


On Sep 24, 11:16 am, ouwsh <ou...@ouwsh.com> wrote:
> My computer build on  windows  Ruby 1.9.1  ,rails 2.3.4 mysql
>

It's a bug in rails 2.3.4

Fred

ouwsh

unread,
Sep 24, 2009, 1:55:44 PM9/24/09
to Ruby on Rails: Talk
oh,Thank for you help,

Do you know how to fix this bug with ruby 1.9.1 on rails 2.3.4 ? Just
on way I choose rails 2.3.2 or older?

On 9月24日, 下午7时45分, Frederick Cheung <frederick.che...@gmail.com>
wrote:

Frederick Cheung

unread,
Sep 24, 2009, 1:58:45 PM9/24/09
to Ruby on Rails: Talk


On Sep 24, 6:55 pm, ouwsh <ou...@ouwsh.com> wrote:
> oh,Thank for you help,
>
> Do you know how to fix this bug with ruby 1.9.1 on rails 2.3.4 ? Just
> on way I choose rails 2.3.2 or older?
>

downgrading to 2.3.3 probably the easiest thing.

Fred

ouwsh

unread,
Sep 24, 2009, 2:20:33 PM9/24/09
to Ruby on Rails: Talk
Oh,I See

Thanks very much for you help again.I am study ruby & ROR from
yesterday,I try rails 2.3.3 now

BTW,I am chinese,My English is so poor,if have some mistake in
English,please don't care ~ ^_^

On 9月25日, 上午1时58分, Frederick Cheung <frederick.che...@gmail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages