Ruby on Rails Thursday, March 3, 2011

On 3 March 2011 07:43, Chandu80 <chandu.shenoy@gmail.com> 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
>
> <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 %>:</textarea>

What happens if you just have, just to check it is not an issue with
the text area
<p>@<%= h posted_by_name %>:</p>

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

--
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@googlegroups.com.
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.

No comments:

Post a Comment