On 29 August 2013 17:51, Tamara Temple <tamouse.li...@gmail.com> wrote: > > On Aug 27, 2013, at 12:25 PM, Nick Khamis <sym...@gmail.com> wrote: > >> Hello Tamouse, >> >> >> >> It sounds now like you are setting that via an AJAX call. >> >> This is correct. We are using JQuery to manage the payload. >> >> >> Where you need to look is in the controller that is responding to that >> >> AJAX call in your Rails application, >> >> and look how it is determining the value it will send for the picture >> >> source url. That is likely where you >> >> need to use asset_url (without any ERB stuff) to set that part of the >> >> JSON payload that gets returned >> >> to the client. >> >> I know this makes total sense, the problem is I am too new to Rails (not the >> case for C, C++ or Lisp) to >> understand :). The value for wine.picture url is coming straight from the >> database: >> >> +----+----------------------------------------------+------+----------------+---------------------------------------+ >> | id | name | year | country | >> picture | >> +----+----------------------------------------------+------+----------------+---------------------------------------+ >> | 1 | CHATEAU DE SAINT COSME | 2009 | France | saint_cosme.jpg >> | >> >> If I understand you correctly, I would need to modify the picture field in >> the database to >> read asset_url('saint_cosme.jpg') without any of the ERB stuff "<%= %>"? > > Do not modify the value in your database. > >> Or if by controller you mean rails controller in the traditional sense, I >> have a very simple >> `pages_controller.rb` that contains the following: > > I mean the controller that is being called by your AJAX request. It is > entirely possible this in not your Rails app, but I would think it would be. > You have to look at your javascript and find the AJAX call, then look at the > url in that call to find the route it's seeking, and match that route to the > controller. You can find out which routes map to controllers by running `rake > routes`.
Also you can look in log/development.log to see what, if any, action is being called in the rails app when you perform the action. 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+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLukFSEqV96d9e78z7L3JLX_jNaYP6frEUVuPbeR-07Lhg%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.