ruby - rails showing blank page -


in rails app need implement conditional search form .there 2 tables named tweets , coordinates , output showing blank page , stuck dis. coordinates_controller

class coordinatescontroller < applicationcontroller   def home    end  # def paramas(b)   #      # @b = params[:show]    # return @b    end  #def coor(latitude,longitude)   # @latitude=0    #@longitude=0   #end    def query     @a=coordinates.find("city=?", params[:show])     if(params[:show]= a.city)        latitude= a.latitude       longitude=a.longitude     end     if(latitude=0 && longitude=0)       return  sql="select * tweets tweet_text '%text%' , user_loc 'params[:show]' order id desc"     else if (latitude!=0 && longitude!=0)             min_lat = latitude - 1.0            max_lat = latitude + 1.0            min_lng = longitude - 1.0            max_lng =  longitude + 1.0            return   sql = "select * tweets tweet_text '%text%' , ( ((longitude between min_lng , max_lng) , (latitude between min_lat , max_lat)) or (user_loc 'params[:show]') ) order id desc"          else            return   sql="select *  tweets tweet_text  '%text%'"          end          end   end      

my tweets_controller class tweetscontroller < applicationcontroller

include coordinateshelper   def search     render 'tweets/search'   end     def index     # include coordinateshelper     sql=query    @tweets=tweets.paginate_by_sql(sql, :page => @page, :per_page => @per_page )     #render 'tweets/index'   end end 

my view code search button

<%=form_tag({controller: 'tweets', action:'index'},  method: "get") %> <%=label_tag(:search, "search for:") %> <%=text_field_tag(:text) %> <%=label_tag(:show, "show for:") %> <%=text_field_tag(:show) %> <%= submit_tag( "go" ) %> <% end %> 

my view code display results

<%= will_paginate @tweets %> <% @tweets.each |tweets| %>  <ul>    <li><%= tweets.id %></li>   <li><%= tweets.tweet_created_at %></li>    <li><%= tweets.tweet_source %></li>   <li><%= tweets.tweet_text %></li>   <li><%= tweets.user_id %></li>   <li><%= tweets.user_name %></li>   <li><%= tweets.user_sc_name %></li> <li><%= tweets.user_loc %></li>   <li><%= tweets.user_img %></li>   <li><%= tweets.longitude %></li>   <li><%= tweets.latitude %></li> <li><%= tweets.place %></li>   <li><%= tweets.country %></li>  </ul> <% end %> 

but reasons output showing empty page tried editing several tymes in vain. kindly me wid dis, struggling wid dis long tym

in query method, wrote , finder method, have write table name there, not model name, finders works on model name, write :

in query method replace :

@a=coordinates.find("city=?", params[:show]) 

with :

@a=coordinate.find("city=?", params[:show]) 

because model name, remain singular, unless make changes configuration. , think, there problem params[:show] this. please paste result of 'params[:show]'

hope help. thanks


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -