Hello, i have started using ruby on rails, and searched the web for this information but found nothing! My problem is : i have main.html.rb and inside a conditional : <% if controller.controller_name == "main" %> do something <% else if controller.controller_name == "other_controller" %> do something <% else %> do something <% end %> The problem is: im using netbeans and netbeans shows "Unexpected-end- of-file" at the end in the close html tag. So whats the problem? There is not else if tags in ror? If i use if - else - end it runs fine but not if-else if-else-end.TIA --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
try elsif Simon On Sat, 07 Feb 2009 23:33:37 +0900, akira <wilsonaikeda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hello, i have started using ruby on rails, and searched the web for > this information but found nothing! > My problem is : i have main.html.rb and inside a conditional : > > <% if controller.controller_name == "main" %> > > do something > > <% else if controller.controller_name == "other_controller" %> > > do something > > <% else %> > > do something > > <% end %>--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Elsif Blog: random8.zenunit.com Learn rails: sensei.zenunit.com On 08/02/2009, at 1:33 AM, akira <wilsonaikeda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hello, i have started using ruby on rails, and searched the web for > this information but found nothing! > My problem is : i have main.html.rb and inside a conditional : > > <% if controller.controller_name == "main" %> > > do something > > <% else if controller.controller_name == "other_controller" %> > > do something > > <% else %> > > do something > > <% end %> > > The problem is: im using netbeans and netbeans shows "Unexpected-end- > of-file" at the end in the close html tag. > So whats the problem? There is not else if tags in ror? If i use if - > else - end it runs fine but not if-else if-else-end.TIA > > >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
2009/2/8 Julian Leviston <julian-AfxEtdRqmE/tt0EhB6fy4g@public.gmane.org>> > Elsif >elsif is the way to do it, but why doesn''t ''else if'' work? The ''if'' being the statement to be executed in the ''else'' case> > Blog: random8.zenunit.com > Learn rails: sensei.zenunit.com > > On 08/02/2009, at 1:33 AM, akira <wilsonaikeda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hello, i have started using ruby on rails, and searched the web for > > this information but found nothing! > > My problem is : i have main.html.rb and inside a conditional : > > > > <% if controller.controller_name == "main" %> > > > > do something > > > > <% else if controller.controller_name == "other_controller" %> > > > > do something > > > > <% else %> > > > > do something > > > > <% end %> > > > > The problem is: im using netbeans and netbeans shows "Unexpected-end- > > of-file" at the end in the close html tag. > > So whats the problem? There is not else if tags in ror? If i use if - > > else - end it runs fine but not if-else if-else-end.TIA > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi, thanks for the reply, the problem is : when i use elseif and run the program, i get an error saying that it cannot recognize elseif and strangely all ruby code in netbeans color syntax is in blue but not elseif statements?. This is what i get when running elseif : undefined method `elseif'' for #<ActionView::Base:0x21dae8c> Well, im using if (many_args) - end, if (many_args) - end for now. Thanks for replying. On Feb 8, 10:55 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> 2009/2/8 Julian Leviston <jul...-AfxEtdRqmE/tt0EhB6fy4g@public.gmane.org> > > > > > Elsif > > elsif is the way to do it, but why doesn''t ''else if'' work? The ''if'' being > the statement to be executed in the ''else'' case > > > > > Blog:random8.zenunit.com > > Learn rails:sensei.zenunit.com > > > On 08/02/2009, at 1:33 AM, akira <wilsonaik...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hello, i have started using ruby on rails, and searched the web for > > > this information but found nothing! > > > My problem is : i have main.html.rb and inside a conditional : > > > > <% if controller.controller_name == "main" %> > > > > do something > > > > <% else if controller.controller_name == "other_controller" %> > > > > do something > > > > <% else %> > > > > do something > > > > <% end %> > > > > The problem is: im using netbeans and netbeans shows "Unexpected-end- > > > of-file" at the end in the close html tag. > > > So whats the problem? There is not else if tags in ror? If i use if - > > > else - end it runs fine but not if-else if-else-end.TIA--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
There is only one e in elsif (not elseif). Don''t ask me why, one of the few annoying things in Ruby. 2009/2/8 wilson ikeda <wilsonaikeda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> > Hi, thanks for the reply, the problem is : when i use elseif and run > the program, i get an error saying that it cannot recognize elseif and > strangely all ruby code in netbeans color syntax is in blue but not > elseif statements?. This is what i get when running elseif : > > undefined method `elseif'' for #<ActionView::Base:0x21dae8c> > > Well, im using if (many_args) - end, if (many_args) - end for now. > Thanks for replying. > > On Feb 8, 10:55 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > 2009/2/8 Julian Leviston <jul...-AfxEtdRqmE/tt0EhB6fy4g@public.gmane.org> > > > > > > > > > Elsif > > > > elsif is the way to do it, but why doesn''t ''else if'' work? The ''if'' being > > the statement to be executed in the ''else'' case > > > > > > > > > Blog:random8.zenunit.com > > > Learn rails:sensei.zenunit.com > > > > > On 08/02/2009, at 1:33 AM, akira <wilsonaik...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > Hello, i have started using ruby on rails, and searched the web for > > > > this information but found nothing! > > > > My problem is : i have main.html.rb and inside a conditional : > > > > > > <% if controller.controller_name == "main" %> > > > > > > do something > > > > > > <% else if controller.controller_name == "other_controller" %> > > > > > > do something > > > > > > <% else %> > > > > > > do something > > > > > > <% end %> > > > > > > The problem is: im using netbeans and netbeans shows "Unexpected-end- > > > > of-file" at the end in the close html tag. > > > > So whats the problem? There is not else if tags in ror? If i use if - > > > > else - end it runs fine but not if-else if-else-end.TIA > > >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Feb 8, 1:55 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> 2009/2/8 Julian Leviston <jul...-AfxEtdRqmE/tt0EhB6fy4g@public.gmane.org> > > > > > Elsif > > elsif is the way to do it, but why doesn''t ''else if'' work? The ''if'' being > the statement to be executed in the ''else'' case >it does work, but if foo ... else if bla ... end isn''t valid (since the else has no matching end statement) You''d need if foo ... else if bla ... end end Fred> > > > Blog:random8.zenunit.com > > Learn rails:sensei.zenunit.com > > > On 08/02/2009, at 1:33 AM, akira <wilsonaik...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hello, i have started using ruby on rails, and searched the web for > > > this information but found nothing! > > > My problem is : i have main.html.rb and inside a conditional : > > > > <% if controller.controller_name == "main" %> > > > > do something > > > > <% else if controller.controller_name == "other_controller" %> > > > > do something > > > > <% else %> > > > > do something > > > > <% end %> > > > > The problem is: im using netbeans and netbeans shows "Unexpected-end- > > > of-file" at the end in the close html tag. > > > So whats the problem? There is not else if tags in ror? If i use if - > > > else - end it runs fine but not if-else if-else-end.TIA--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Not elseif Elsif Blog: random8.zenunit.com Learn rails: sensei.zenunit.com On 09/02/2009, at 5:05 AM, wilson ikeda <wilsonaikeda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi, thanks for the reply, the problem is : when i use elseif and run > the program, i get an error saying that it cannot recognize elseif and > strangely all ruby code in netbeans color syntax is in blue but not > elseif statements?. This is what i get when running elseif : > > undefined method `elseif'' for #<ActionView::Base:0x21dae8c> > > Well, im using if (many_args) - end, if (many_args) - end for now. > Thanks for replying. > > On Feb 8, 10:55 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> 2009/2/8 Julian Leviston <jul...-AfxEtdRqmE/tt0EhB6fy4g@public.gmane.org> >> >> >> >>> Elsif >> >> elsif is the way to do it, but why doesn''t ''else if'' work? The ''if'' >> being >> the statement to be executed in the ''else'' case >> >> >> >>> Blog:random8.zenunit.com >>> Learn rails:sensei.zenunit.com >> >>> On 08/02/2009, at 1:33 AM, akira <wilsonaik...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >>>> Hello, i have started using ruby on rails, and searched the web for >>>> this information but found nothing! >>>> My problem is : i have main.html.rb and inside a conditional : >> >>>> <% if controller.controller_name == "main" %> >> >>>> do something >> >>>> <% else if controller.controller_name == "other_controller" %> >> >>>> do something >> >>>> <% else %> >> >>>> do something >> >>>> <% end %> >> >>>> The problem is: im using netbeans and netbeans shows "Unexpected- >>>> end- >>>> of-file" at the end in the close html tag. >>>> So whats the problem? There is not else if tags in ror? If i use >>>> if - >>>> else - end it runs fine but not if-else if-else-end.TIA > >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi, All of the following are valid. The third one is retarded, because by not putting the second if on a new line, you don''t get the indentation, so you can''t visually tell if you''ve got the right number of clauses. I prefer the fourth way. Notice that the 3rd and 4th methods have an extra end, whereas the second method has only one end. if(true) puts ''yay'' else puts ''nay'' end if(false) puts ''yay'' elsif(true) puts ''nay'' end if(false) puts ''woo'' else if(true) puts ''boo'' end end if(false) puts ''woo'' else if(true) puts ''boo'' end end On 09/02/2009, at 5:05 AM, wilson ikeda wrote:> > Hi, thanks for the reply, the problem is : when i use elseif and run > the program, i get an error saying that it cannot recognize elseif and > strangely all ruby code in netbeans color syntax is in blue but not > elseif statements?. This is what i get when running elseif : > > undefined method `elseif'' for #<ActionView::Base:0x21dae8c> > > Well, im using if (many_args) - end, if (many_args) - end for now. > Thanks for replying. > > On Feb 8, 10:55 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> 2009/2/8 Julian Leviston <jul...-AfxEtdRqmE/tt0EhB6fy4g@public.gmane.org> >> >> >> >>> Elsif >> >> elsif is the way to do it, but why doesn''t ''else if'' work? The ''if'' >> being >> the statement to be executed in the ''else'' case >> >> >> >>> Blog:random8.zenunit.com >>> Learn rails:sensei.zenunit.com >> >>> On 08/02/2009, at 1:33 AM, akira <wilsonaik...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >>>> Hello, i have started using ruby on rails, and searched the web for >>>> this information but found nothing! >>>> My problem is : i have main.html.rb and inside a conditional : >> >>>> <% if controller.controller_name == "main" %> >> >>>> do something >> >>>> <% else if controller.controller_name == "other_controller" %> >> >>>> do something >> >>>> <% else %> >> >>>> do something >> >>>> <% end %> >> >>>> The problem is: im using netbeans and netbeans shows "Unexpected- >>>> end- >>>> of-file" at the end in the close html tag. >>>> So whats the problem? There is not else if tags in ror? If i use >>>> if - >>>> else - end it runs fine but not if-else if-else-end.TIA > >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---