[Rails] Re: Ajax in rails

2012-10-02 Thread ruby rails
When I am alerting data I am getting the below htmls inserting before select tag of team members TaskManagement http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js";> http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.min.js";> nith...@gma

[Rails] Re: Ajax in Rails

2009-03-02 Thread phil7085
Ok Fred, I think I understand, I've now changed the controller to look like this: def preview @advert = Advert.new(params[:advert]) render :partial => 'advert', :object => @advert end Before I had: @advert = params[:advert] which I think is what you mean by it not being an instance

[Rails] Re: Ajax in Rails

2009-03-02 Thread Frederick Cheung
On Mar 2, 8:39 am, phil7085 wrote: > Ok I've got it to work by using this in my partial: > > <%= @advert[:title] %> > > Can you tell me why I have to reference like this? > The errors you mentionned imply that @advert isn't actually an instance of the Advert class. Fred > Phil > > On Mar 2, 8:

[Rails] Re: Ajax in Rails

2009-03-02 Thread phil7085
Ok I've got it to work by using this in my partial: <%= @advert[:title] %> Can you tell me why I have to reference like this? Phil On Mar 2, 8:22 am, phil7085 wrote: > Hi guys, > > I've tried both of those options and can't get it to work, I think > it's the way I am trying to retrieve the

[Rails] Re: Ajax in Rails

2009-03-02 Thread phil7085
Hi guys, I've tried both of those options and can't get it to work, I think it's the way I am trying to retrieve the values in the partial. In the development.log I have this error: undefined method `title' for # In my controller I have this: render :partial => 'advert', :object => @advert An

[Rails] Re: Ajax in Rails

2009-03-01 Thread phil7085
Thanks, I will give this a try, although as a newbie this talk of :locals, :object, etc has slightly gone over my head. I'm sure i'll get it. Phil On Mar 1, 8:37 pm, Phlip wrote: > phil7085 wrote: > > How would I then need to tell rails to use the @advert object because > > that's the part th

[Rails] Re: Ajax in Rails

2009-03-01 Thread Frederick Cheung
On Mar 1, 8:42 pm, Phlip wrote: > Frederick Cheung wrote: > > render :partial => 'blah', :object => foo > > To save me from Googling for "object", what does that look like inside the > partial? the object specified in that way is assigned to a local variable called object and to a local varia

[Rails] Re: Ajax in Rails

2009-03-01 Thread Phlip
Frederick Cheung wrote: > render :partial => 'blah', :object => foo To save me from Googling for "object", what does that look like inside the partial? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Ra

[Rails] Re: Ajax in Rails

2009-03-01 Thread Phlip
phil7085 wrote: > How would I then need to tell rails to use the @advert object because > that's the part that I have been having trouble with? Formerly, it was this: def preview @advert = Advert.new(params[:advert]) render :partial => 'advert', :locals =>{ :@advert => @advert } end

[Rails] Re: Ajax in Rails

2009-03-01 Thread Frederick Cheung
On Mar 1, 8:12 pm, phil7085 wrote: > Thanks Fred, > > How would I then need to tell rails to use the @advert object because > that's the part that I have been having trouble with? > render :partial => 'blah', :object => foo Fred > Phil > > On Mar 1, 7:41 pm, Frederick Cheung > wrote: > > > O

[Rails] Re: Ajax in Rails

2009-03-01 Thread phil7085
Thanks Fred, How would I then need to tell rails to use the @advert object because that's the part that I have been having trouble with? Phil On Mar 1, 7:41 pm, Frederick Cheung wrote: > On Mar 1, 7:38 pm, phil7085 wrote:> I am simply > trying to show what the user enters somewhere else on t

[Rails] Re: Ajax in Rails

2009-03-01 Thread Frederick Cheung
On Mar 1, 7:38 pm, phil7085 wrote: > I am simply trying to show what the user enters somewhere else on the > page as they type it. > > I did get it to work using render :text => param[:advert][:title] + > '' + param[:advert][:first_line] .. > > But I think there should be a more efficient w

[Rails] Re: Ajax in Rails

2009-03-01 Thread phil7085
I am simply trying to show what the user enters somewhere else on the page as they type it. I did get it to work using render :text => param[:advert][:title] + '' + param[:advert][:first_line] .. But I think there should be a more efficient way to do it? Could I do something like this: def

[Rails] Re: Ajax in Rails

2009-03-01 Thread Frederick Cheung
On Mar 1, 5:10 pm, phil7085 wrote: > So then do I need to use the controller to populate another @advert > object with all the params then render the partial? > Well I don't know exactly what this controller is trying to do at all. Assuming what it's doing is create a new object then the contr

[Rails] Re: Ajax in Rails

2009-03-01 Thread phil7085
So then do I need to use the controller to populate another @advert object with all the params then render the partial? Cheers, Phil On Mar 1, 5:00 pm, Frederick Cheung wrote: > On Mar 1, 1:04 pm, phil7085 wrote: > > > > > I've been trying to create a simple form which when a user enters any

[Rails] Re: Ajax in Rails

2009-03-01 Thread Frederick Cheung
On Mar 1, 1:04 pm, phil7085 wrote: > > I've been trying to create a simple form which when a user enters any > data that data is displayed as a preview elsewhere on the page > instantly, just like when creating an advert with Google Adwords, the > preview is shown. > > I've been using form_remote