gmaps4rails in update action

39 views
Skip to first unread message

bencarsal

unread,
Oct 9, 2012, 10:48:24 AM10/9/12
to actives...@googlegroups.com
Hi group,

i want to know if somebody has gmaps4rails in the action update in activescaffold.

i have this:

in helper about my controller mymodel_helper.rb:
  def locate_form_column(record, options)
     gmaps4rails(record.to_gmaps4rails)
  end

and in the model have this virtual column:

attr_accessible :locate
 def locate=(_longitud,_latitud)
    latitude = _latitud
    longitude = _longitud
  end
   
  def locate
    "#{latitude} - #{longitude}"
  end

in the controller:
active_scaffold :sites do |conf|
    conf.columns << :locate

i tried this record.to_gmaps4rails have the right data, and gmaps4rails helper not throws errors, but the situation is that this helper not show anything. In other sections in the proyect show the map correct.
in the documentation of gmaps4rails say that is necesary the "<%= yield :scripts %>" in the layout and i have this in my layout.  Will be possible do that in activescaffold?. i think that the javascripts necessaries for show the maps are inhibited in this section of activescaffold....

Any idea?

thanks in advance

best regards

Hernan Astudillo

unread,
Oct 9, 2012, 3:53:37 PM10/9/12
to actives...@googlegroups.com
First of all: rails version? AS version?

notice that on rails>3.1 assets are handled through asset pipeline.

AS > 3.1 helper override format is
[model]_[column]_form_column(record, column)

you can test logging what gmaps4rails(record.to_gmaps4rails) is outputing.



--
You received this message because you are subscribed to the Google Groups "ActiveScaffold : Ruby on Rails plugin" group.
To view this discussion on the web visit https://groups.google.com/d/msg/activescaffold/-/jhUBcyeTXTkJ.
To post to this group, send email to actives...@googlegroups.com.
To unsubscribe from this group, send email to activescaffol...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/activescaffold?hl=en.

ser...@entrecables.com

unread,
Oct 10, 2012, 3:38:04 PM10/10/12
to actives...@googlegroups.com
[column]_form_column(record, column) should work too, but you can get
problems with columns with same name in different models, for example,
in subforms

On Tue, 9 Oct 2012 15:53:37 -0400, Hernan Astudillo <naa...@gmail.com>
wrote:
> First of all: rails version? AS version?
>
> notice that on rails>3.1 assets are handled through asset pipeline.
>
> AS > 3.1 helper override format is
> [model]_[column]_form_column(record, column)
>
> you can test logging what gmaps4rails(record.to_gmaps4rails) is
> outputing.
>
> On Tue, Oct 9, 2012 at 11:48 AM, bencarsal wrote:
> Hi group,
>
> i want to know if somebody has gmaps4rails in the action update in
> activescaffold.
>
> i have this:
>
> in helper about my controller mymodel_helper.rb:
>
>   def locate_form_column(record, options)
>      gmaps4rails(record.to_gmaps4rails)
>   end
>
> and in the model have this virtual column:
>
> attr_accessible :locate
>
>  def locate=(_longitud,_latitud)
>     latitude = _latitud
>     longitude = _longitud
>   end
>    
>   def locate
>     "#{latitude} - #{longitude}"
>   end
>
> in the controller:
>
> active_scaffold :sites do |conf|
>     conf.columns
>
> Links:
> ------
> [1] mailto:benc...@gmail.com
> [2] https://groups.google.com/d/msg/activescaffold/-/jhUBcyeTXTkJ
> [3] mailto:actives...@googlegroups.com
> [4] mailto:activescaffold%2Bunsu...@googlegroups.com
> [5] http://groups.google.com/group/activescaffold?hl=en

ser...@entrecables.com

unread,
Oct 10, 2012, 3:49:48 PM10/10/12
to actives...@googlegroups.com
Check in the log if gmaps4rails/_gmaps4rails partial is rendered.

On Tue, 9 Oct 2012 07:48:24 -0700 (PDT), bencarsal
<benc...@gmail.com> wrote:
> Hi group,
>
> i want to know if somebody has gmaps4rails in the action update in
> activescaffold.
>
> i have this:
>
> in helper about my controller mymodel_helper.rb:
>
> def locate_form_column(record, options)
> gmaps4rails(record.to_gmaps4rails)
> end
>
> and in the model have this virtual column:
>
> attr_accessible :locate
>
> def locate=(_longitud,_latitud)
> latitude = _latitud
> longitude = _longitud
> end
>
> def locate
> "#{latitude} - #{longitude}"
> end
>
> in the controller:
>
> active_scaffold :sites do |conf|
> conf.columns
>
> Links:
> ------
> [1] https://groups.google.com/d/msg/activescaffold/-/jhUBcyeTXTkJ

Benjamín Cárdenas Salamandra

unread,
Oct 10, 2012, 7:13:02 PM10/10/12
to actives...@googlegroups.com
Thanks for your answer,

rails version 3.2.6, AS version: 3.2.16, jruby version: 1.9.2-p312 (with
torquebox)

and like Sergio say, the helper override works, because this show me the
box, but without render the map (is all green like the background form)

El 10/10/2012 14:38, ser...@entrecables.com escribi�:

Benjamín Cárdenas Salamandra

unread,
Oct 10, 2012, 7:17:57 PM10/10/12
to actives...@googlegroups.com
thanks Sergio, the log say that

Rendered /home/gertec/torquebox-2.1.2/jruby/lib/ruby/gems/1.8/gems/gmaps4rails-1.5.5/app/views/gmaps4rails/_gmaps4rails.html.erb (21.0ms)

umm, seems like i need put an initial coordinate (box), i'll try and if it works i will comment


El 10/10/2012 14:49, ser...@entrecables.com escribi�:

ser...@entrecables.com

unread,
Oct 11, 2012, 12:41:48 PM10/11/12
to actives...@googlegroups.com
Check scripts in source code or using web inspector. Are you using
inline or page link to update? If you use inline link layout is not
rendered, so scripts are not included.
Reply all
Reply to author
Forward
0 new messages