Thursday, October 15, 2009

Ruby on Rails : Comment Single line / Multiple lines

Comment single line of code is using "#", however, for multiple line is using "=begin" and "=end" in .rb, and "<!-- -->" in .rhtml.

In Controller.rb









10 
11 
12 
13 
14 
15 
16 
17 
18 
    # Single line
    # PUT /people/1
    # PUT /people/1.xml

    def update
      @person = Person.find(params[:id])
=begin (Multiple lines)
      respond_to do |format|
       if @person.update_attributes(params[:person])
        flash[:notice] = 'Person was successfully updated.'
        format.html { redirect_to(@person) }
        format.xml { head :ok }
       else
        format.html { render :action => "edit" }
        format.xml { render :xml => @person.errors, :status => :unprocessable_entity }
       end
      end
=end

    end

In View.rhtml
<!-- Single Line -->
<% # @people = Person.find(:all) %>

<!-- Multiple Lines -->
<!--
<% for person in @people %>
<%= person.name %>
<% end %>
-->

38 comments:

  1. Thanks for sharing such a nice tip. Whenever some one is new to web development it is very important to first learn programming language as per my knowledge. Well ruby is one of the best programming language for Rails development. If you are looking for ROR developers in India email us at: info@cryptextechnologies.com

    ReplyDelete
    Replies
    1. When you are searching to hire a website design company then you should always choose reliable and professional, Revise is the best government website design company which contains good record and be ready to give you site according to your needs.

      Delete
  2. Thanks for the tips on the comment single line in ROR. You can find related web development tools and resources here. http://www.jqueryplugins.net

    ReplyDelete
  3. Great article Lot's of information to Read... Great Man Keep Posting and update to People..Thanks

    java forums

    ReplyDelete
  4. perfect explanation about java programming .its very useful.thanks for your valuable information.java training in chennai | java training in chennai chennai, tamil nadu

    ReplyDelete
  5. Great, what a collaboration. I love your blog post. keep sharing. Thanks
    Hire RoR Developer

    ReplyDelete
  6. Great sharing. Cryptex Technologies Pvt. Ltd. is an IT company which focuses on providing services to client. The company works on Ruby on Rails Platform since it was started in October 2007. If you are looking for ruby on rails developers in india, then contact us at: info@cryptextextechnologies.com

    ReplyDelete
  7. After reading this blog i very strong in this topics and this blog really helpful to all... explanation are very clear so very easy to understand... thanks a lot for sharing this blog more info on Ruby on Rails Online Training

    ReplyDelete
  8. Nice blog and absolutely outstanding. You can do something much better but i still say this perfect.Keep trying for the best. ROR Development Company India,

    ReplyDelete
  9. I’m trampled by your contents carry on the wonderful work. array

    ReplyDelete
  10. Nice tutorial. Thanks for sharing the valuable information. it’s really helpful. Who want to learn this blog most helpful. Keep sharing on updated tutorials…
    Click here:
    angularjs6 Training in Chennai
    Click here:
    Microsoft azure training in chennai
    Click here:
    angularjs6 Training in Chennai
    Click here:
    angularjs Training in online

    ReplyDelete
  11. Good Post, I am a big believer in posting comments on sites to let the blog writers know that they ve added something advantageous to the world wide web.
    Click here:
    Microsoft azure training in chennai
    Click here:
    Microsoft azure training in annanagar
    Click here:
    Microsoft azure training in velarchery
    Click here:
    Microsoft azure training in sollinganallur

    ReplyDelete
  12. Pleasant Tips..Thanks for Sharing….We keep up hands on approach at work and in the workplace, keeping our business pragmatic, which recommends we can help you with your tree clearing and pruning in an invaluable and fit way.

    Data Science Training in Chennai | Data Science course in anna nagar
    Data Science course in chennai | Data science course in Bangalore
    Data Science course in marathahalli | Data Science course in btm

    ReplyDelete
  13. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
    java training in chennai | java training in USA

    ReplyDelete
  14. Nice Blog, When i was read this blog i learnt new things & its truly have well stuff related to developing technology, Thank you for sharing this blog.
    Microsoft Azure Training in Chennai | Azure Training in Chennai

    ReplyDelete
  15. Nice Blog, When i was read this blog i learnt new things & its truly have well stuff related to developing technology ruby on rails online training Hyderabad

    ReplyDelete
  16. I am happy for sharing on this blog its awesome blog I really impressed. thanks for sharing.

    Become an Expert In Software Testing Training! The most trusted and trending Programming Language. Learn from experienced Trainers and get the knowledge to crack a coding interview, @Softgen Infotech Located in BTM Layout.

    ReplyDelete
  17. I like your post very much. It is very much useful for my research. I hope you to share more info about this. Keep posting Ruby On Rails Training

    ReplyDelete
  18. ExcelR provides data scientist course in pune. It is a great platform for those who want to learn and become a Business Analytics. Students are tutored by professionals who have a degree in a particular topic. It is a great opportunity to learn and grow.

    data scientist course in pune
    Data science course
    Data scientist course
    Data science course in pune


    ReplyDelete
  19. AI Patasala aims at providing the most effective Python Training in Hyderabad. Our school has taught a lot of individuals and assisted them in locating good jobs.
    Online Python Course in Hyderabad

    ReplyDelete