# How can i make ruby line comments

**URL:** <https://www.ruby-forum.com/t/how-can-i-make-ruby-line-comments/136089>\
**Category:** Rails\
**Created:** [April 28, 2008, 9:01pm UTC](https://www.ruby-forum.com/t/how-can-i-make-ruby-line-comments/136089 "2008-04-28T21:01:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![manish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@manish](https://www.ruby-forum.com/u/manish)\
**Post date:** [April 28, 2008, 9:01pm UTC](https://www.ruby-forum.com/t/how-can-i-make-ruby-line-comments/136089/1 "2008-04-28T21:01:53Z")

</div>

In ruby we can make a line comments by using #.  
but when we use the same ruby code in .rhtml, how can i make comments a  
line

\<%= link\_to ‘Create New Book’, :controller =\> ‘Book’, :action =\> ‘list’  
%\>

I want to comment this line in .rhtml file…how can i do that…

---

<div class="post-metadata">

**Author:** ![manish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@manish](https://www.ruby-forum.com/u/manish)\
**Post date:** [April 28, 2008, 9:07pm UTC](https://www.ruby-forum.com/t/how-can-i-make-ruby-line-comments/136089/2 "2008-04-28T21:07:16Z")

</div>

On Apr 28, 2008, at 3:01 PM, Manish N. wrote:

> I want to comment this line in .rhtml file…how can i do that…  
> \<%#= link\_to ‘Create New Book’, :controller =\> ‘Book’, :action =\>  
> ‘list’ %\>  
> \<%# this is an erb comment %\>

-Rob

Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![manish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@manish](https://www.ruby-forum.com/u/manish)\
**Post date:** [April 28, 2008, 9:17pm UTC](https://www.ruby-forum.com/t/how-can-i-make-ruby-line-comments/136089/3 "2008-04-28T21:17:57Z")

</div>

Rob B. wrote:

> On Apr 28, 2008, at 3:01 PM, Manish N. wrote:
> 
> > I want to comment this line in .rhtml file…how can i do that…  
> > \<%#= link\_to ‘Create New Book’, :controller =\> ‘Book’, :action =\>  
> > ‘list’ %\>  
> > \<%# this is an erb comment %\>
> 
> -Rob
> 
> Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
> removed\_email\_address@domain.invalid

Thnx Rob…

There is one more error…

i m new to ROR…  
i make a simple prog for login…  
Username and password…  
if(right)  
{  
login  
}  
else  
{  
error msg  
}

can u help me in this…

---

<div class="post-metadata">

**Author:** ![manish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@manish](https://www.ruby-forum.com/u/manish)\
**Post date:** [April 28, 2008, 10:01pm UTC](https://www.ruby-forum.com/t/how-can-i-make-ruby-line-comments/136089/4 "2008-04-28T22:01:36Z")

</div>

On Apr 28, 2008, at 3:17 PM, Manish N. wrote:

> > 
> 
> if(right)  
> {  
> login  
> }  
> else  
> {  
> error msg  
> }
> 
> can u help me in this…

Well, that’s not really enough to go on. Take a look at the  
restful\_authentication plugin or follow along with Agile Web  
Development with Rails for that kind of thing.

-Rob

Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![manish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@manish](https://www.ruby-forum.com/u/manish)\
**Post date:** [April 28, 2008, 10:09pm UTC](https://www.ruby-forum.com/t/how-can-i-make-ruby-line-comments/136089/5 "2008-04-28T22:09:40Z")

</div>

thanx ROB for u r advice…

but still i dnt knw how 2 use…if u hav any code for lgoin method  
thn pls paste it here…i m getting prbolm of …  
NoMethodError

## my method is…

## def login\_submit if session[‘user’] @logged\_in = true else @logged\_in = false end @user = User.new(@params[‘user’]) if @session[‘user’] = User.authenticate(@params[‘user’][‘username’], @params[‘user’][‘password’]) flash[:notice] = l(:user\_login\_succeeded) redirect\_to :action =\> ‘welcome’ else @login = @params[‘user’][‘login’] flash.now[:notice] = l(:user\_login\_failed) end end

and in the rhtml file the form is…

\<% form\_tag :controller =\> “user”, :action =\> “login\_submit” do %\>

Username: &nbsp;

Password: &nbsp;

  

## \<%= submit\_tag “Login”%\> \<% end %\>

so can you help mee what is this prblm …

---

<div class="post-metadata">

**Author:** ![manish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@manish](https://www.ruby-forum.com/u/manish)\
**Post date:** [April 28, 2008, 10:27pm UTC](https://www.ruby-forum.com/t/how-can-i-make-ruby-line-comments/136089/6 "2008-04-28T22:27:12Z")

</div>

On Apr 28, 2008, at 4:09 PM, Manish N. wrote:

> if session[‘user’]  
> @logged\_in = true  
> else  
> @logged\_in = false  
> end  
> @user = User.new(@params[‘user’])  
> if @session[‘user’] = User.authenticate(@params[‘user’]  
> [‘username’],  
> @params[‘user’][‘password’])  
> flash[:notice] = l(:user\_login\_succeeded)  
> Where is the l method defined? Is that where your NoMethodError comes  
> from?

Also, don’t user the @session or @params variables, use the session  
and params methods instead:

if session[‘user’] = User.authenticate(params[‘user’][‘username’],  
params[‘user’][‘password’])

-Rob

> \<% form\_tag :controller =\> “user”, :action =\> “login\_submit” do %\>
> 
> Username: &nbsp;
> 
> Password: &nbsp;
> 
>   
> 
> ## \<%= submit\_tag “Login”%\> \<% end %\>
> 
> so can you help mee what is this prblm …

Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![manish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@manish](https://www.ruby-forum.com/u/manish)\
**Post date:** [April 30, 2008, 8:12pm UTC](https://www.ruby-forum.com/t/how-can-i-make-ruby-line-comments/136089/7 "2008-04-30T20:12:38Z")

</div>

I remove all the things which you hav said…  
but still the same prblm…and this code is running fine in my  
office pc.  
but not working in my home pc.

can u tell me wht the reason…???
