app/views/category/new.erb In this file , i have two line like this <!-- <p><label for="book_subject">Subject</label>: --> <!-- <%= collection_select(:book,:subject_id,@subjects,:id,:name) %></p> --> But, if these two lines are present , i get an error saying "you have an unexpected nil error" ---------------------------- here is the full file: app/views/category# more new* <h1>Add new Category </h1> <%= form_tag :action => ''create''%> <p><label for="category_title">Category Title</label>: <%= text_field ''category'', ''category_title'' %></p> <p><label for="categoy_short_desc">Category Short Description</label>: <%= text_field ''category'', ''category_short_desc'' %></p> <p><label for="categoy_long_desc">Category Long Description</label>: <%= text_area ''category'', ''category_long_desc'' %></p> <!-- <p><label for="book_subject">Subject</label>: --> <!-- <%= collection_select(:book,:subject_id,@subjects,:id,:name) %></p> --> <%= submit_tag "Create" %> <%= form_tag %> <%= link_to ''Back'', {:action => ''list''} %> ----------------------- If i remove these two lines <!-- <p><label for="book_subject">Subject</label>: --> <!-- <%= collection_select(:book,:subject_id,@subjects,:id,:name) %></p> --> then new.erb works fine. Why so? Why can''t comment these two lines? I''m sure there is some problem. But, i couldn''t see what it is. please let me know if u could what the problem is in cmmenting these two lines. thanks, radha -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
well its strange :)) you are Doing exactly ok for comments as i see http://www.w3schools.com/tags/tag_comment.asp You should post this with new username RailsConfusing Radhathat may works..:) On Sun, Jun 27, 2010 at 10:05 AM, RailsFan Radha <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:> > > app/views/category/new.erb > > In this file , i have two line like this > > <!-- <p><label for="book_subject">Subject</label>: --> > > <!-- <%= collection_select(:book,:subject_id,@subjects,:id,:name) %></p> > --> > > But, if these two lines are present , i get an error saying > "you have an unexpected nil error" > > ---------------------------- > here is the full file: > app/views/category# more new* > <h1>Add new Category </h1> > <%= form_tag :action => ''create''%> > <p><label for="category_title">Category Title</label>: > <%= text_field ''category'', ''category_title'' %></p> > > <p><label for="categoy_short_desc">Category Short Description</label>: > <%= text_field ''category'', ''category_short_desc'' %></p> > > <p><label for="categoy_long_desc">Category Long Description</label>: > <%= text_area ''category'', ''category_long_desc'' %></p> > > > <!-- <p><label for="book_subject">Subject</label>: --> > > <!-- <%= collection_select(:book,:subject_id,@subjects,:id,:name) %></p> > --> > > > > > <%= submit_tag "Create" %> > <%= form_tag %> > <%= link_to ''Back'', {:action => ''list''} %> > > > > ----------------------- > > If i remove these two lines > <!-- <p><label for="book_subject">Subject</label>: --> > > <!-- <%= collection_select(:book,:subject_id,@subjects,:id,:name) %></p> > --> > > then new.erb works fine. > > Why so? > Why can''t comment these two lines? > > I''m sure there is some problem. But, i couldn''t see what it is. > > > please let me know if u could what the problem is in cmmenting these two > lines. > > > > thanks, > radha > -- > Posted via http://www.ruby-forum.com/. > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- Thanks: Rajeev sharma -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
please look at this also http://htmlhelp.com/reference/wilbur/misc/comment.html On Sun, Jun 27, 2010 at 10:13 AM, kannav rajeev <rajeevsharma86-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> well its strange :)) > you are Doing exactly ok for comments as i see > http://www.w3schools.com/tags/tag_comment.asp > You should post this with new username > RailsConfusing Radhathat may works..:) > > > On Sun, Jun 27, 2010 at 10:05 AM, RailsFan Radha <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote: > >> >> >> app/views/category/new.erb >> >> In this file , i have two line like this >> >> <!-- <p><label for="book_subject">Subject</label>: --> >> >> <!-- <%= collection_select(:book,:subject_id,@subjects,:id,:name) %></p> >> --> >> >> But, if these two lines are present , i get an error saying >> "you have an unexpected nil error" >> >> ---------------------------- >> here is the full file: >> app/views/category# more new* >> <h1>Add new Category </h1> >> <%= form_tag :action => ''create''%> >> <p><label for="category_title">Category Title</label>: >> <%= text_field ''category'', ''category_title'' %></p> >> >> <p><label for="categoy_short_desc">Category Short Description</label>: >> <%= text_field ''category'', ''category_short_desc'' %></p> >> >> <p><label for="categoy_long_desc">Category Long Description</label>: >> <%= text_area ''category'', ''category_long_desc'' %></p> >> >> >> <!-- <p><label for="book_subject">Subject</label>: --> >> >> <!-- <%= collection_select(:book,:subject_id,@subjects,:id,:name) %></p> >> --> >> >> >> >> >> <%= submit_tag "Create" %> >> <%= form_tag %> >> <%= link_to ''Back'', {:action => ''list''} %> >> >> >> >> ----------------------- >> >> If i remove these two lines >> <!-- <p><label for="book_subject">Subject</label>: --> >> >> <!-- <%= collection_select(:book,:subject_id,@subjects,:id,:name) %></p> >> --> >> >> then new.erb works fine. >> >> Why so? >> Why can''t comment these two lines? >> >> I''m sure there is some problem. But, i couldn''t see what it is. >> >> >> please let me know if u could what the problem is in cmmenting these two >> lines. >> >> >> >> thanks, >> radha >> -- >> Posted via http://www.ruby-forum.com/. >> >> -- >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> >> . >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. >> >> > > > -- > Thanks: > Rajeev sharma > >-- Thanks: Rajeev sharma -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sat, Jun 26, 2010 at 9:35 PM, RailsFan Radha <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> <!-- <p><label for="book_subject">Subject</label>: --> > > <!-- <%= collection_select(:book,:subject_id,@subjects,:id,:name) %></p> > --> > > But, if these two lines are present , i get an error saying > "you have an unexpected nil error"So find where your Ruby error is -- this certainly has nothing to do with HTML commenting. -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi, I am looking for Matz and Keiju''s book is first published, the first Ruby book.Please mail if any one have, Cheers, Sai On Sun, Jun 27, 2010 at 11:02 AM, Hassan Schroeder < hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Sat, Jun 26, 2010 at 9:35 PM, RailsFan Radha <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> > wrote: > > > <!-- <p><label for="book_subject">Subject</label>: --> > > > > <!-- <%= collection_select(:book,:subject_id,@subjects,:id,:name) %></p> > > --> > > > > But, if these two lines are present , i get an error saying > > "you have an unexpected nil error" > > So find where your Ruby error is -- this certainly has nothing to do > with HTML commenting. > > -- > Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > twitter: @hassan > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Can you post categories controller new action content? On Jun 27, 7:35 am, RailsFan Radha <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> app/views/category/new.erb > > In this file , i have two line like this > > <!-- <p><label for="book_subject">Subject</label>: --> > > <!-- <%= collection_select(:book,:subject_id,@subjects,:id,:name) %></p> > --> > > But, if these two lines are present , i get an error saying > "you have an unexpected nil error" > > ---------------------------- > here is the full file: > app/views/category# more new* > <h1>Add new Category </h1> > <%= form_tag :action => ''create''%> > <p><label for="category_title">Category Title</label>: > <%= text_field ''category'', ''category_title'' %></p> > > <p><label for="categoy_short_desc">Category Short Description</label>: > <%= text_field ''category'', ''category_short_desc'' %></p> > > <p><label for="categoy_long_desc">Category Long Description</label>: > <%= text_area ''category'', ''category_long_desc'' %></p> > > <!-- <p><label for="book_subject">Subject</label>: --> > > <!-- <%= collection_select(:book,:subject_id,@subjects,:id,:name) %></p> > --> > > <%= submit_tag "Create" %> > <%= form_tag %> > <%= link_to ''Back'', {:action => ''list''} %> > > ----------------------- > > If i remove these two lines > <!-- <p><label for="book_subject">Subject</label>: --> > > <!-- <%= collection_select(:book,:subject_id,@subjects,:id,:name) %></p> > --> > > then new.erb works fine. > > Why so? > Why can''t comment these two lines? > > I''m sure there is some problem. But, i couldn''t see what it is. > > please let me know if u could what the problem is in cmmenting these two > lines. > > thanks, > radha > -- > Posted viahttp://www.ruby-forum.com/.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
change <!-- <%= collection_select(:book,:subject_id,@subjects,:id,:name) %></ p>> -->to <%#= collection_select(:book,:subject_id,@subjects,:id,:name) %> On Jun 27, 5:35 am, RailsFan Radha <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> app/views/category/new.erb > > In this file , i have two line like this > > <!-- <p><label for="book_subject">Subject</label>: --> > > <!-- <%= collection_select(:book,:subject_id,@subjects,:id,:name) %></p> > --> > > But, if these two lines are present , i get an error saying > "you have an unexpected nil error" > > ---------------------------- > here is the full file: > app/views/category# more new* > <h1>Add new Category </h1> > <%= form_tag :action => ''create''%> > <p><label for="category_title">Category Title</label>: > <%= text_field ''category'', ''category_title'' %></p> > > <p><label for="categoy_short_desc">Category Short Description</label>: > <%= text_field ''category'', ''category_short_desc'' %></p> > > <p><label for="categoy_long_desc">Category Long Description</label>: > <%= text_area ''category'', ''category_long_desc'' %></p> > > <!-- <p><label for="book_subject">Subject</label>: --> > > <!-- <%= collection_select(:book,:subject_id,@subjects,:id,:name) %></p> > --> > > <%= submit_tag "Create" %> > <%= form_tag %> > <%= link_to ''Back'', {:action => ''list''} %> > > ----------------------- > > If i remove these two lines > <!-- <p><label for="book_subject">Subject</label>: --> > > <!-- <%= collection_select(:book,:subject_id,@subjects,:id,:name) %></p> > --> > > then new.erb works fine. > > Why so? > Why can''t comment these two lines? > > I''m sure there is some problem. But, i couldn''t see what it is. > > please let me know if u could what the problem is in cmmenting these two > lines. > > thanks, > radha > -- > Posted viahttp://www.ruby-forum.com/.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Ugis Ozols wrote:> Can you post categories controller new action content?here is this: though the erb is called as "new.erb". the action in the controller is named as "create" def create @category = Category.new(params[:category]) if @category.save redirect_to :action => ''list'' else # @subjects = Subject.find(:all) render :action => ''new'' end end -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
here is the full content of category_controller.rb -------------------------------------------------- class CategoryController < ApplicationController def index # "List all categories" list render:action=>''list'' end #--- List-- def list # @categories=Category.find_recent_categories @categories=Category.find_all_categories end #---- Show --- def show # @category=Category.find(params[:category_id]) @category=Category.find(params[:category_id]) end #-------------edit ----------- def edit @category=Category.find(params[:id]) # @book = Book.find(params[:id]) # @subjects = Subject.find(:all) end #-----create ---------- def create @category = Category.new(params[:category]) if @category.save redirect_to :action => ''list'' else # @subjects = Subject.find(:all) render :action => ''new'' end end # --- Update --- def update @category = Category.find(params[:category_id]) if @category.update_attributes(params[:category]) flash[:notice]=''Successfully updated'' redirect_to:action=> ''show'', :category_id => @category else render:action => ''edit'' end end #-----------Delete ------------ def delete Category.find(params[:id]).destroy redirect_to :action => ''list'' end end -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Just thought of giving a bit moe info: So, i added these two lines back into new.erb and reproduced this error. here is the exact error message: --------------------------------------------------- NoMethodError in Category#new Showing app/views/category/new.erb where line #14 raised: You have a nil object when you didn''t expect it! You might have expected an instance of Array. The error occurred while evaluating nil.map Extracted source (around line #14): 11: 12: <!-- <p><label for="book_subject">Subject</label>: --> 13: 14: <!-- <%= collection_select(:book,:subject_id,@subjects,:id,:name) %></p> --> 15: 16: 17: ----------------------------------------------------- And when i remove these two lines, new.erb works fine. thanks, radha -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sun, Jun 27, 2010 at 5:26 AM, RailsFan Radha <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> here is the exact error message:> You have a nil object when you didn''t expect it! > You might have expected an instance of Array. > > Extracted source (around line #14):> 14: <!-- <%= collection_select(:book,:subject_id,@subjects,:id,:name)Hint: where on line 14 do you see something that should be an Array? And where is the value of that Array object being set in your code? -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 27 June 2010 05:35, RailsFan Radha <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> app/views/category/new.erb > > In this file , i have two line like this > > <!-- <p><label for="book_subject">Subject</label>: --> > > <!-- <%= collection_select(:book,:subject_id,@subjects,:id,:name) %></p> > --> > > But, if these two lines are present , i get an error saying > "you have an unexpected nil error"Regardless of the HTML comments in your view file, the Ruby inside the <% %> tags will get evaluated - if it''s invalid it will error (as it is); if it''s valid, you''d end up with a commented-out html select tag... if you just want it commented, comment the Ruby: <!-- <%#= collection_select(:book,:subject_id,@subjects,:id,:name) %></p> --> If you want a select tag, read the documents on collection_select and ensure @subjects is correctly populated with objects (or is an empty array). http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#M002303 -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I am new in ruby but i will try to help you. I think that in your controller should have the new def def new ....... @subjects = Subject.find(:all) ........ end this will give information that you need in your view file. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
hi, you can not just comment these lines because the second line having Ruby code inside<%= ...%> for this line you may use # like as written below. <%#= collection_select(:book,:subject_id,@subjects,:id,:name) %> Now it is commented out. And code will not read this line... Anything else, You are most welcome. Santosh On Jun 27, 9:35 am, RailsFan Radha <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> app/views/category/new.erb > > In this file , i have two line like this > > <!-- <p><label for="book_subject">Subject</label>: --> > > <!-- <%= collection_select(:book,:subject_id,@subjects,:id,:name) %></p> > --> > > But, if these two lines are present , i get an error saying > "you have an unexpected nil error" > > ---------------------------- > here is the full file: > app/views/category# more new* > <h1>Add new Category </h1> > <%= form_tag :action => ''create''%> > <p><label for="category_title">Category Title</label>: > <%= text_field ''category'', ''category_title'' %></p> > > <p><label for="categoy_short_desc">Category Short Description</label>: > <%= text_field ''category'', ''category_short_desc'' %></p> > > <p><label for="categoy_long_desc">Category Long Description</label>: > <%= text_area ''category'', ''category_long_desc'' %></p> > > <!-- <p><label for="book_subject">Subject</label>: --> > > <!-- <%= collection_select(:book,:subject_id,@subjects,:id,:name) %></p> > --> > > <%= submit_tag "Create" %> > <%= form_tag %> > <%= link_to ''Back'', {:action => ''list''} %> > > ----------------------- > > If i remove these two lines > <!-- <p><label for="book_subject">Subject</label>: --> > > <!-- <%= collection_select(:book,:subject_id,@subjects,:id,:name) %></p> > --> > > then new.erb works fine. > > Why so? > Why can''t comment these two lines? > > I''m sure there is some problem. But, i couldn''t see what it is. > > please let me know if u could what the problem is in cmmenting these two > lines. > > thanks, > radha > -- > Posted viahttp://www.ruby-forum.com/.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jun 27, 9:35 am, RailsFan Radha <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> app/views/category/new.erb > > In this file , i have two line like this > > <!-- <p><label for="book_subject">Subject</label>: --> > > <!-- <%= collection_select(:book,:subject_id,@subjects,:id,:name) %></p> > --> > > But, if these two lines are present , i get an error saying > "you have an unexpected nil error" > > ---------------------------- > here is the full file: > app/views/category# more new* > <h1>Add new Category </h1> > <%= form_tag :action => ''create''%> > <p><label for="category_title">Category Title</label>: > <%= text_field ''category'', ''category_title'' %></p> > > <p><label for="categoy_short_desc">Category Short Description</label>: > <%= text_field ''category'', ''category_short_desc'' %></p> > > <p><label for="categoy_long_desc">Category Long Description</label>: > <%= text_area ''category'', ''category_long_desc'' %></p> > > <!-- <p><label for="book_subject">Subject</label>: --> > > <!-- <%= collection_select(:book,:subject_id,@subjects,:id,:name) %></p> > --> > > <%= submit_tag "Create" %> > <%= form_tag %> > <%= link_to ''Back'', {:action => ''list''} %> > > ----------------------- > > If i remove these two lines > <!-- <p><label for="book_subject">Subject</label>: --> > > <!-- <%= collection_select(:book,:subject_id,@subjects,:id,:name) %></p> > --> > > then new.erb works fine. > > Why so? > Why can''t comment these two lines? > > I''m sure there is some problem. But, i couldn''t see what it is. > > please let me know if u could what the problem is in cmmenting these two > lines. > > thanks, > radha > -- > Posted viahttp://www.ruby-forum.com/.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
ssmithstone wrote:> change > > <!-- <%= collection_select(:book,:subject_id,@subjects,:id,:name) %></ > p> >> --> > > to <%#= collection_select(:book,:subject_id,@subjects,:id,:name) %>thanks for all . thanks rajeev and hassan and michael. thanks MicahelPavling, santosh, axelsef and ssmithstone. special thanks to michael, santosh and ssmithstone, I commented those two lines as per your explanation as ruby evaluates them first before generating the html and it works fine. thanks again! -radha -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.