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 %>
-->

22 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. Thanks you for sharing this unique useful information content with us. Really awesome work. keep on blogging
    DevOps online Training|DevOps Training in USA
    Devops Training in Chennai

    Devops Training in Bangalore

    ReplyDelete
  13. 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
  14. 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
  15. Does your blog have a contact page? I’m having problems locating it but, I’d like to shoot you an email. I’ve got some recommendations for your blog you might be interested in hearing.
    AWS Training in Chennai |Best Amazon Web Services Training in Chennai
    AWS Training in Rajaji Nagar | Amazon Web Services Training in Rajaji Nagar

    Best AWS Training Institute in BTM Layout Bangalore ,AWS Coursesin BTM

    ReplyDelete