James Whittaker
2006-Apr-25 13:36 UTC
[Rails] case statements in views...strange error on OSX
I have a simple case statement in one of my views. This works fine on my windows machine. Move to the mac and I get: "parse error, unexpected tIDENTIFIER, expecting kWHEN". I have not changed anything but cannot resolve the issue. my view has this in it (simplified for test) <% case controller.controller_name -%> <% when "accounts" -%> <h3>worked accounts</h3> <% else -%> <h3>worked else</h3> <% end -%> I have reset the server everything. I''m using rails 1.1.1 and the latest stable ruby build. Please help? -- Posted via http://www.ruby-forum.com/.
James Whittaker
2006-Apr-25 13:48 UTC
[Rails] Re: case statements in views...strange error on OSX
James Whittaker wrote:> I have a simple case statement in one of my views. This works fine on my > windows machine. Move to the mac and I get: "parse error, unexpected > tIDENTIFIER, expecting kWHEN". > > I have not changed anything but cannot resolve the issue. my view has > this in it (simplified for test) > > <% case controller.controller_name -%> > <% when "accounts" -%> > <h3>worked accounts</h3> > <% else -%> > <h3>worked else</h3> > <% end -%> > > I have reset the server everything. I''m using rails 1.1.1 and the latest > stable ruby build. Please help?Is it because I cannot split a case statement up like an if statement? -- Posted via http://www.ruby-forum.com/.
Stephen Bartholomew
2006-Apr-25 13:55 UTC
[Rails] Re: case statements in views...strange error on OSX
I''ve tested this code on Freebsd 5.3/Ruby 1.8/rails 1.0 and it runs fine so i wouldn''t have thought it''s syntax... Steve James Whittaker wrote:> James Whittaker wrote: > >>I have a simple case statement in one of my views. This works fine on my >>windows machine. Move to the mac and I get: "parse error, unexpected >>tIDENTIFIER, expecting kWHEN". >> >>I have not changed anything but cannot resolve the issue. my view has >>this in it (simplified for test) >> >><% case controller.controller_name -%> >><% when "accounts" -%> >><h3>worked accounts</h3> >><% else -%> >><h3>worked else</h3> >><% end -%> >> >>I have reset the server everything. I''m using rails 1.1.1 and the latest >>stable ruby build. Please help? > > > Is it because I cannot split a case statement up like an if statement? >
James Whittaker
2006-Apr-25 14:33 UTC
[Rails] Re: Re: case statements in views...strange error on OSX
Stephen Bartholomew wrote:> I''ve tested this code on Freebsd 5.3/Ruby 1.8/rails 1.0 and it runs fine > so i wouldn''t have thought it''s syntax... > > SteveThanks Steve, still not working, really bugging me this is. Could someone try on OSX to check ? -- Posted via http://www.ruby-forum.com/.
James Whittaker
2006-Apr-25 14:50 UTC
[Rails] Re: Re: case statements in views...strange error on OSX
James Whittaker wrote:> Stephen Bartholomew wrote: >> I''ve tested this code on Freebsd 5.3/Ruby 1.8/rails 1.0 and it runs fine >> so i wouldn''t have thought it''s syntax... >> >> Steve > > Thanks Steve, still not working, really bugging me this is. Could > someone try on OSX to check ?Still no joy there seems to be a direct problem with using case statements in rails on OSX. Everything I try results in an error. Is this linked to rails 1.1.1 ?? -- Posted via http://www.ruby-forum.com/.
Guest
2006-Apr-25 16:05 UTC
[Rails] Re: Re: case statements in views...strange error on OSX
James Whittaker wrote:> James Whittaker wrote: >> Stephen Bartholomew wrote: >>> I''ve tested this code on Freebsd 5.3/Ruby 1.8/rails 1.0 and it runs fine >>> so i wouldn''t have thought it''s syntax... >>> >>> Steve >> >> Thanks Steve, still not working, really bugging me this is. Could >> someone try on OSX to check ? > > Still no joy there seems to be a direct problem with using case > statements in rails on OSX. Everything I try results in an error. Is > this linked to rails 1.1.1 ??Has anyone used a case statement in a view without issue on OSX ? -- Posted via http://www.ruby-forum.com/.
Kevin Olbrich
2006-Apr-25 16:21 UTC
[Rails] Re: Re: case statements in views...strange error on OSX
Have you been retyping this in OSX, or are you still working with the same file from your PC? Could it be a character set issue? On Tuesday, April 25, 2006, at 4:48 PM, James Whittaker wrote:>James Whittaker wrote: >> Stephen Bartholomew wrote: >>> I''ve tested this code on Freebsd 5.3/Ruby 1.8/rails 1.0 and it runs fine >>> so i wouldn''t have thought it''s syntax... >>> >>> Steve >> >> Thanks Steve, still not working, really bugging me this is. Could >> someone try on OSX to check ? > >Still no joy there seems to be a direct problem with using case >statements in rails on OSX. Everything I try results in an error. Is >this linked to rails 1.1.1 ?? > >-- >Posted via http://www.ruby-forum.com/. >_______________________________________________ >Rails mailing list >Rails@lists.rubyonrails.org >http://lists.rubyonrails.org/mailman/listinfo/rails_Kevin -- Posted with http://DevLists.com. Sign up and save your mailbox.
Guest
2006-Apr-25 16:37 UTC
[Rails] Re: Re: case statements in views...strange error on OSX
Kevin Olbrich wrote:> Have you been retyping this in OSX, or are you still working with the > same file from your PC? Could it be a character set issue? > > On Tuesday, April 25, 2006, at 4:48 PM, James Whittaker wrote: >>Still no joy there seems to be a direct problem with using case >>statements in rails on OSX. Everything I try results in an error. Is >>this linked to rails 1.1.1 ?? >> >>-- >>Posted via http://www.ruby-forum.com/. >>_______________________________________________ >>Rails mailing list >>Rails@lists.rubyonrails.org >>http://lists.rubyonrails.org/mailman/listinfo/rails > > > _KevinI have tried both. What I can now gather is that when you use a case statement inside a view it does not like being written like this: <% case controller.controller_name -%> <% when "accounts" -%> <h3>worked accounts</h3> <% else -%> <h3>worked else</h3> <% end -%> If I retype it like the example underneath it does not error but also does not work, produces nothing. Yet on the PC it works fine. <% case controller.controller_name when "accounts" ''<h3>worked accounts</h3>'' else ''<h3>worked else</h3>'' end %> What makes it even more interesting is that I wish to call a helper method inside the case statement like this: <% case controller.controller_name -%> <% when "accounts" -%> <%= sub_tab "Overview", :controller=>''accounts'', :action => ''index''%> <%= sub_tab "List Employees", :controller=>''accounts'', :action => ''list'' %> <%= sub_tab "Roles & Permissions", :controller=>''accounts'', :action => ''permissions'' %> <% when "clients" -%> <%= sub_tab "List Clients", :controller=>''clients'', :action => ''index'' %> <% else -%> <%= sub_tab "Overview", :controller=>''projects'', :action => ''index'' %> <% end -%> Is there is another way to do what i''m trying to do without using case statements? -- Posted via http://www.ruby-forum.com/.
John Tsombakos
2006-Apr-25 16:49 UTC
[Rails] Re: Re: case statements in views...strange error on OSX
On 4/25/06, Guest <j.whittaker@spectrais.com> wrote:> Has anyone used a case statement in a view without issue on OSX ?I just tried a test, using OS X (10.4.6, Rails 1.1.2): <% case @book.name -%> <% when "book" %> Is Book<br> <% else %> Not Book<br> <% end %> and it worked just fine. jt
Guest
2006-Apr-25 16:53 UTC
[Rails] Re: Re: Re: case statements in views...strange error on OSX
John Tsombakos wrote:> On 4/25/06, Guest <j.whittaker@spectrais.com> wrote: >> Has anyone used a case statement in a view without issue on OSX ? > > I just tried a test, using OS X (10.4.6, Rails 1.1.2): > > <% case @book.name -%> > <% when "book" %> > Is Book<br> > <% else %> > Not Book<br> > <% end %> > > > and it worked just fine. > > jtThanks jt. So I have a ruby or rails issue then. i am running the same as you so that is really odd. here goes for an update. -- Posted via http://www.ruby-forum.com/.
John Tsombakos
2006-Apr-25 17:06 UTC
[Rails] Re: Re: Re: case statements in views...strange error on OSX
On 4/25/06, Guest <j.whittaker@spectrais.com> wrote:> Thanks jt. So I have a ruby or rails issue then. i am running the same > as you so that is really odd. here goes for an update.That is an odd one. Can you do a case statement using irb? irb(main):001:0> b=''book'' => "book" irb(main):002:0> case b irb(main):003:1> when ''car'' irb(main):004:1> puts "is a car" irb(main):005:1> when ''book'' irb(main):006:1> puts "is a book" irb(main):007:1> else irb(main):008:1* puts "nothing" irb(main):009:1> end is a book
Guest
2006-Apr-25 17:15 UTC
[Rails] Re: Re: Re: Re: case statements in views...strange error on
John Tsombakos wrote:> On 4/25/06, Guest <j.whittaker@spectrais.com> wrote: > >> Thanks jt. So I have a ruby or rails issue then. i am running the same >> as you so that is really odd. here goes for an update. > > That is an odd one. Can you do a case statement using irb? > > irb(main):001:0> b=''book'' > => "book" > irb(main):002:0> case b > irb(main):003:1> when ''car'' > irb(main):004:1> puts "is a car" > irb(main):005:1> when ''book'' > irb(main):006:1> puts "is a book" > irb(main):007:1> else > irb(main):008:1* puts "nothing" > irb(main):009:1> end > is a bookThat works fine. I have just updated ruby and rails to the latest versions and it still does not work. I have created a new rails project and just added this in the view: <h1>Runme#index</h1> <p>Find me in app/views/runme/index.rhtml</p> <% case controller_controller_name %> <% when ''runme'' %> <h3>hello</h3> <% else %> <h1>not ok</h1> <% end %> This is the error I get: SyntaxError in Runme#index Showing app/views/runme/index.rhtml where line #3 raised: compile error script/../config/../app/views/runme/index.rhtml:3: parse error, unexpected tIDENTIFIER, expecting kWHEN case controller_controller_name ; _erbout.concat "\n" ^ script/../config/../app/views/runme/index.rhtml:4: parse error, unexpected kWHEN, expecting kEND when ''runme'' ; _erbout.concat "\n" ^ script/../config/../app/views/runme/index.rhtml:10: parse error, unexpected kEND, expecting $ Extracted source (around line #3): 1: <h1>Runme#index</h1> 2: <p>Find me in app/views/runme/index.rhtml</p> 3: <% case controller_controller_name %> 4: <% when ''runme'' %> 5: <h3>hello</h3> 6: <% else %> Trace of template inclusion: /app/views/runme/index.rhtml RAILS_ROOT: script/../config/.. Application Trace | Framework Trace | Full Trace #{RAILS_ROOT}/app/views/runme/index.rhtml:10:in `compile_template'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:305:in `compile_and_render_template'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:290:in `render_template'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:249:in `render_file'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:699:in `render_file'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:621:in `render_with_no_layout'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/layout.rb:251:in `render_without_benchmark'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:53:in `render'' /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:53:in `render'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:911:in `perform_action_without_filters'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:368:in `perform_action_without_benchmark'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'' /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/rescue.rb:82:in `perform_action'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:381:in `process_without_filters'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:377:in `process_without_session_management_support'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/session_management.rb:117:in `process'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:in `dispatch'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:115:in `handle_dispatch'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:81:in `service'' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' /usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' /usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' /usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'' /usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'' /usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'' /usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:67:in `dispatch'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/servers/webrick.rb:59 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/server.rb:30 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' script/server:3 #{RAILS_ROOT}/app/views/runme/index.rhtml:10:in `compile_template'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:305:in `compile_and_render_template'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:290:in `render_template'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:249:in `render_file'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:699:in `render_file'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:621:in `render_with_no_layout'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/layout.rb:251:in `render_without_benchmark'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:53:in `render'' /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:53:in `render'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:911:in `perform_action_without_filters'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:368:in `perform_action_without_benchmark'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'' /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/rescue.rb:82:in `perform_action'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:381:in `process_without_filters'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:377:in `process_without_session_management_support'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/session_management.rb:117:in `process'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:in `dispatch'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:115:in `handle_dispatch'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:81:in `service'' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' /usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' /usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' /usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'' /usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'' /usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'' /usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:67:in `dispatch'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/servers/webrick.rb:59 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/server.rb:30 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' script/server:3 Request Parameters: None Show session dump --- flash: !map:ActionController::Flash::FlashHash {} Response Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"} I dont know what to do? -- Posted via http://www.ruby-forum.com/.
John Tsombakos
2006-Apr-25 17:22 UTC
[Rails] Re: Re: Re: Re: case statements in views...strange error on
On 4/25/06, Guest <j.whittaker@spectrais.com> wrote:> <h1>Runme#index</h1> > <p>Find me in app/views/runme/index.rhtml</p> > <% case controller_controller_name %> > <% when ''runme'' %> > <h3>hello</h3> > <% else %> > <h1>not ok</h1> > <% end %>Was that just a typeo? - ... case controller.controller_name ...
Wilson Bilkovich
2006-Apr-25 17:24 UTC
[Rails] Re: Re: Re: Re: case statements in views...strange error on
What happens when you say: <% case ''runme'': %> instead of <% case ''runme'' %> ? On 4/25/06, Guest <j.whittaker@spectrais.com> wrote:> John Tsombakos wrote: > > On 4/25/06, Guest <j.whittaker@spectrais.com> wrote: > > > >> Thanks jt. So I have a ruby or rails issue then. i am running the same > >> as you so that is really odd. here goes for an update. > > > > That is an odd one. Can you do a case statement using irb? > > > > irb(main):001:0> b=''book'' > > => "book" > > irb(main):002:0> case b > > irb(main):003:1> when ''car'' > > irb(main):004:1> puts "is a car" > > irb(main):005:1> when ''book'' > > irb(main):006:1> puts "is a book" > > irb(main):007:1> else > > irb(main):008:1* puts "nothing" > > irb(main):009:1> end > > is a book > > That works fine. I have just updated ruby and rails to the latest > versions and it still does not work. I have created a new rails project > and just added this in the view: > > <h1>Runme#index</h1> > <p>Find me in app/views/runme/index.rhtml</p> > <% case controller_controller_name %> > <% when ''runme'' %> > <h3>hello</h3> > <% else %> > <h1>not ok</h1> > <% end %> > > This is the error I get: > > SyntaxError in Runme#index > > Showing app/views/runme/index.rhtml where line #3 raised: > > compile error > script/../config/../app/views/runme/index.rhtml:3: parse error, > unexpected tIDENTIFIER, expecting kWHEN > case controller_controller_name ; _erbout.concat "\n" > ^ > script/../config/../app/views/runme/index.rhtml:4: parse error, > unexpected kWHEN, expecting kEND > when ''runme'' ; _erbout.concat "\n" > ^ > script/../config/../app/views/runme/index.rhtml:10: parse error, > unexpected kEND, expecting $ > > Extracted source (around line #3): > > 1: <h1>Runme#index</h1> > 2: <p>Find me in app/views/runme/index.rhtml</p> > 3: <% case controller_controller_name %> > 4: <% when ''runme'' %> > 5: <h3>hello</h3> > 6: <% else %> > > Trace of template inclusion: /app/views/runme/index.rhtml > > RAILS_ROOT: script/../config/.. > Application Trace | Framework Trace | Full Trace > > #{RAILS_ROOT}/app/views/runme/index.rhtml:10:in `compile_template'' > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:305:in > `compile_and_render_template'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:290:in > `render_template'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:249:in > `render_file'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:699:in > `render_file'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:621:in > `render_with_no_layout'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/layout.rb:251:in > `render_without_benchmark'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:53:in > `render'' > /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:53:in > `render'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:911:in > `perform_action_without_filters'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:368:in > `perform_action_without_benchmark'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in > `perform_action_without_rescue'' > /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in > `perform_action_without_rescue'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/rescue.rb:82:in > `perform_action'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:381:in > `process_without_filters'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:377:in > `process_without_session_management_support'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/session_management.rb:117:in > `process'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:in > `dispatch'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:115:in > `handle_dispatch'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:81:in > `service'' > /usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' > /usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' > /usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' > /usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' > /usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'' > /usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'' > /usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'' > /usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:67:in > `dispatch'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/servers/webrick.rb:59 > /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in > `require'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in > `require'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/server.rb:30 > /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in > `require'' > script/server:3 > > #{RAILS_ROOT}/app/views/runme/index.rhtml:10:in `compile_template'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:305:in > `compile_and_render_template'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:290:in > `render_template'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:249:in > `render_file'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:699:in > `render_file'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:621:in > `render_with_no_layout'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/layout.rb:251:in > `render_without_benchmark'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:53:in > `render'' > /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:53:in > `render'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:911:in > `perform_action_without_filters'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:368:in > `perform_action_without_benchmark'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in > `perform_action_without_rescue'' > /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in > `perform_action_without_rescue'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/rescue.rb:82:in > `perform_action'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:381:in > `process_without_filters'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:377:in > `process_without_session_management_support'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/session_management.rb:117:in > `process'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:in > `dispatch'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:115:in > `handle_dispatch'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:81:in > `service'' > /usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' > /usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' > /usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' > /usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' > /usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'' > /usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'' > /usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'' > /usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:67:in > `dispatch'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/servers/webrick.rb:59 > /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in > `require'' > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in > `require'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/server.rb:30 > /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in > `require'' > script/server:3 > > Request > > Parameters: None > > Show session dump > > --- > flash: !map:ActionController::Flash::FlashHash {} > > > Response > Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"} > > > I dont know what to do? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Guest
2006-Apr-25 17:47 UTC
[Rails] Re: Re: Re: Re: Re: case statements in views...strange error
Wilson Bilkovich wrote:> What happens when you say: > > <% case ''runme'': %> instead of <% case ''runme'' %> > ?SOLVED !!! It seems that you have to have the case and the first when on the same ruby line e.g: <% case controller.controller_name when ''runme'' %> instead of: <% case controller.controller_name %> <% when ''runme'' %> How strange is that, I thought that it would not matter? Anyway on with the project... -- Posted via http://www.ruby-forum.com/.
I had this same problem yesterday. I''m on XP though, Ruby 1.8.4 mswin32, and Rails 1.1.2. I found two ways around it: 1. Encapsulate the whole case statement in <%= %> 2. Encapsulate the first when with the case keyword, i.e. <% b = :banana %> <% case b when String %> It''s a string! <% when Symbol %> No it''s a symbol! <% end %> -- Posted via http://www.ruby-forum.com/.
John Tsombakos
2006-Apr-25 18:18 UTC
[Rails] Re: Re: Re: Re: Re: case statements in views...strange error
On 4/25/06, Guest <j.whittaker@spectrais.com> wrote:> Wilson Bilkovich wrote: > > What happens when you say: > > > > <% case ''runme'': %> instead of <% case ''runme'' %> > > ? > > SOLVED !!! > > It seems that you have to have the case and the first when on the same > ruby line e.g: > > <% case controller.controller_name when ''runme'' %> > > instead of: > > > <% case controller.controller_name %> > <% when ''runme'' %> > > How strange is that, I thought that it would not matter? Anyway on with > the project...Very odd. As I posted above, this code works just fine in a test app in show.rhtml: <% case controller.controller_name -%> <% when "books" %> Is Book<br> <% else %> Not Book<br> <% end %> jt