Ruby on Rails Tuesday, August 27, 2013

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 "<%=    %>"?

Or if by controller you mean rails controller in the traditional sense, I have a very simple
`pages_controller.rb` that contains the following:

class PagesController < ApplicationController
  def index
  end  
end

As usual, forgive the noob, and thanks in advance!!!

Nick.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/48648655-f787-43e6-9325-56797fdc86b7%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment