Show a value in view

Hello All,
I am working on a microblogging application.(similar to twitter)
In my controller there is a method called replypopUp.It is a method
that runs when the reply link on timeline is clicked.When I a click on
the link a pop-up appears in which there is a text area and a post
button.Inside the text area,the name of the user to whom I am replying
should appear in the form ‘@username:’
Now in my controller method I am taking that user’s name using
@posted_by_name = params[:posted_by]
In my view my text area looks like this

<textarea name=“message” id=“message” maxlength =“400”
style="overflow:auto;width:100%;height:
56px ;"onkeyup="checkPostFieldLength(message,‘remaining’,
400);"onkeydown="checkPostFieldLength(message,‘remaining’,
400);"onmouseout=“checkPostFieldLength(message,‘remaining’, 400);”>@<
%=h @posted_by_name %>:

The text within <% %> is the username I am trying to paste by default
inside the text area
However when I run the application,I only get" @:" in the text
area.The name of the user does not appear.
I have also tried to check using http watch,and I see the url being
passed correctly,so there is no chance of params[:posted_by] being
taken as a null value.
Kindly let me know if my way of displaying the valaue is incorrect.If
yes how should I display it in my view?

Thanks in Advance

Regards
Chandrika

On 3 March 2011 07:43, Chandu80 [email protected] wrote:

Hello All,
I am working on a microblogging application.(similar to twitter)
In my controller there is a method called replypopUp.It is a method
that runs when the reply link on timeline is clicked.When I a click on
the link a pop-up appears in which there is a text area and a post
button.Inside the text area,the name of the user to whom I am replying
should appear in the form ‘@username:’
Now in my controller method I am taking that user’s name using
@posted_by_name = params[:posted_by]

Use ruby-debug (see the Rails Guide on debugging if you do not know
how to do this) to break in here and examine @posted_by_name

In my view my text area looks like this

@< %=h @posted_by_name %>:

What happens if you just have, just to check it is not an issue with
the text area

@<%= h posted_by_name %>:

The text within <% %> is the username I am trying to paste by default
inside the text area
However when I run the application,I only get" @:" in the text
area.The name of the user does not appear.
I have also tried to check using http watch,and I see the url being
passed correctly,so there is no chance of params[:posted_by] being
taken as a null value.

You can check the params by looking in log/development.log.

Colin

Hi,
I tried executing the below statement and it just gave me “@:”

What happens if you just have, just to check it is not an issue with
the text area

@<%= h posted_by_name %>:

Regards
Chandrika

On 3 March 2011 10:39, Chandu80 [email protected] wrote:

Hi,
I tried executing the below statement and it just gave me “@:”

What happens if you just have, just to check it is not an issue with
the text area

@<%= h posted_by_name %>:

I meant @posted_by_name of course. Sorry.

By the way could you not top post please, it makes it difficult to
follow the thread. Insert your reply at appropriate point(s) in
previous message. Thanks

Colin

Hi,
I also tried

@<%=h @posted_by_name.inspect %>:

and it gave

@nil:

Some null value being returned from URL.
Thanks for the help.

Regards
Chandrika

On 3 March 2011 10:47, Chandu80 [email protected] wrote:

Hi,

By the way could you not top post please, it makes it difficult to
follow the thread. Insert your reply at appropriate point(s) in
previous message. Thanks

I also tried

@<%=h @posted_by_name.inspect %>:

and it gave

@nil:

In that case, obviously, @posted_by_name is nil. What did you see
when you used ruby-debug to break into the controller code?

Colin

Hi Colin,
Sorry for the email clutter.
I am actually working on jRuby on Rails.
And the organisation I work in allows only the approved gems to be
installed.
However I could track the nil value from the development log file.
Thanks for the help.

Regards
Chandrika