Ruby on Rails Sunday, April 27, 2014

Thanks for looking at it. There goes the home controller bellow. And yes
I am using gem 'jquery-rails'. What is funny is that in my development
environment locally it is working. This error is from an passenger/nginx
installation.
Rod

class HomeController < ApplicationController
layout 'home'

def index

#sleep 1.5
#@shops = Shop.order("name").page(params[:page])
@shops = Shop.order('created_at desc').paginate(:per_page => 2,
:page => params[:page])
#User.paginate(:page => params[:page])

#query = Product.joins(:category)
query = Shop.joins(:product_options).where("product_id=1")
sql = query.to_sql

sql = "SELECT * from products"
r = ActiveRecord::Base.connection.execute(sql)
@query = r = r

zip= params[:zip]
@foundZip=false

if (!zip.nil? && !zip.blank?)
zip = zip.gsub('.','')
gc = GeoCity.find_by_ZIP(zip)
end

if (!gc.nil? && zip!=nil && !zip.blank?) # found zip
@foundZip=true
end

if request.xhr?
respond_to do |format|
format.html
format.js {render 'index' }
end
end
end
end




mike2r wrote in post #1144230:
> On Friday, April 25, 2014 11:22:23 PM UTC-4, Ruby-Forum.com User wrote:
>> net::ERR_BLOCKED_BY_CLIENT rev.js:4
>> at Function.target.(anonymous function)
>> event.preventDefault() instead. jquery.js:75
>> //
>> //= require jquery_ujs
>>
>>
>> # Specifies the header that your server uses for sending files
>>
>> server
>> # config.threadsafe!
>> # with SQLite, MySQL, and PostgreSQL)
>> <%= csrf_meta_tags %>
>> <html>
>>
>
src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
>> <!-- IE6 "fix" for the close png image -->
>> <ul class="sub-menu">
>> <% end %>
>> </li>
>> </html>
>>
>> --
>> Posted via http://www.ruby-forum.com/.
>>
>
> need to see the controller code. Basically, it's executing
> home.html.erb
> as a layout (it's not using the application.html.erb). Because of this,
> the following statement is missed:
>
> <%= javascript_include_tag 'application' %>
>
> I may have a better idea of exactly what's happening when I see the
> controller code. I'm also assuming that you have gem 'jquery-rails' in
> your Gemfile.
>
> Also, I would recommend you read the following guide as you aren't
> properly
> using layouts and templates:
>
> http://edgeguides.rubyonrails.org/layouts_and_rendering.html

--
Posted via http://www.ruby-forum.com/.

--
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/0351c8b596513e5a768f9c349e62abbd%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment