Ruby on Rails Thursday, April 4, 2013

On 4 April 2013 18:18, Praneeth <praneetheee240@gmail.com> wrote:
> hi i have a problem in graphs:
> am representing data in graphical view and in that i put from date, end date
> and search button
> when i select from date, end date and when i press search, values are going
> into controller through ajax and rendering partial but i can't able to pass
> the instance variable in partial view. i have tried the following
> in the controller:
> def abc
> @x1 = Model1.all
> @y1 = Model2.all
>
> render :partial => "partial_name", :@x1 => @x1, :@y1 => @y1
> render :partial => "filter_data", :locals => { :@x1=> @x1, :@y1 => @y1 }

render :partial => "filter_data", :locals => { :x1=>@x1, :y1 => @y1 }
then use x1 and y1 in the partial. See
http://guides.rubyonrails.org/layouts_and_rendering.html#using-partials

If that still does not work then insert puts statements in the partial
to print the values of things to see what is going on. The print will
appear in the server window. Then you will know whether it is getting
the data to the view that is the problem or whether it is the view
code itself.

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment