ruby - undefined local variable or method `int' for Request:Class(rails) -


i facing problem when ever open form "service_create" throws error saying "undefined local variable or method". not know doing wrong please tell me problem(i new rails).

service_request

<%= link_to("back" , {:action => '#'}) %>     <%= form_for(:request , :url => {:action => 'service_request_create'}) |f| %>   <div class="field">     <%= f.label :corresponding_user_from %><br>     <%= f.text_field :corresponding_user_from %>    </div>  <div class="field">     <%= f.label :product_service_location %><br>     <%= f.text_field :product_service_location %>    </div>  <div class="field">     <%= f.label :title %><br>     <%= f.text_field :title %>   </div>    <div class="field">     <%= f.label :description %><br>     <%= f.text_field :description %>   </div>    <!--<%= f.select :category, @categories %> -->    <div class="field">     <% f.collection_select(:category_id , category.all , :_id , :title) %>   </div>    <div class="field">   </div>    <div class="field">     <%= f.radio_button :negotiable, "yes" %>     <%= f.label :negotiable, "yes", :value => "yes" %>     <%= f.radio_button :negotiable, "no" %>     <%= f.label :negotiable, "no", :value => "no" %>   </div>    <div class="field">     <%= f.label :upper_price_range %><br>     <%= f.text_field :upper_price_range %>   </div>      <div class="field">     <%= f.label :lower_price_range %><br>     <%= f.text_field :lower_price_range %>   </div>    <div class="field">     <%= f.label :tags %><br>     <%= f.text_field :tags %>   </div>    <div class="actions">     <%= f.submit %>   </div> <% end %> 

request_controller.rb

class requestscontroller < applicationcontroller   before_action :set_request, only: [:show, :edit, :update, :destroy]    # /requests   # /requests.json   def index    end   def active     user      = session[:user]      @requests = array.new     @category = array.new     @requests = request.getrequestbyuser(user)       @requests.each.with_index |request, index|       if request != nil         @category[index] = array.new         request[:category_id].each |cate|           @category[index] << category.getcategory(cate)         end       end     end   end   # /requests/1   # /requests/1.json   def show     @user     = user.getuser(@request[:user_id])     @category = array.new     @request[:category_id].each |cate|       @category << category.getcategory(cate)     end   end    # /requests/1/edit   def edit     @category = array.new     @request[:category_id].each |cate|         @category << category.getcategory(cate)     end   end   # post /requests   def post_request     tags         = params[:tags] ;     categories   = array.new ;     if tags != nil       tags.each |tag|         category  = category.createcategoryifnotexist(tag)         if(category != nil)           categories << category[:_id]          end       end     end     request_data                = request_params     user_id                     = session[:user]      request_data[:category_id]  = categories      request_data[:user_id]      = user_id     @request_                   = request.createrequest(request_data)     if @request_       flash[:notice] = "request post successfully."       redirect_to :action => "active"     end   end    #post /requests   def service_request   end    def item_request   end    def service_request_create     request_data                = request_params_create     user_id                     = session[:user]      request_data[:is_service]  = "on"     request_data[:user_id]      = user_id     #requests_data[:category]     @request_                   = request.createrequest(request_data)     if @request_       flash[:notice] = "request post successfully."       redirect_to :action => "active"     end   end     def item_service_create     #@req = request.new(request_params)   #@req.typee="item"    # if @req.save    #   redirect_to(:action => 'rpage')    # else    #   render('new')    # end   end        # patch/put /requests/1   # patch/put /requests/1.json   def update     tags         = params[:tags] ;     categories   = array.new ;     if tags != nil       tags.each |tag|         category  = category.createcategoryifnotexist(tag)         if(category != nil)           categories << category[:_id]          end       end     end     rails.logger.info("requestsparams: #{request_params.inspect}")     request_data                = request_params     if request_data[:is_service] != "on"        request_data[:is_service] = "off"      end     user_id                     = session[:user]      request_data[:category_id]  = categories      request_data[:user_id]      = user_id     if request.updaterequest(@request,request_data)       flash[:notice] = "request has been edited successfully."       redirect_to :action => "active"     end   end   def delete_request ()     if request.delete_request(params[:id])       flash[:notice] = "request has been deleted successfully."       render :json => "great"     end   end   private     # use callbacks share common setup or constraints between actions.     def set_request       @request = request.getrequest(params[:id])     end      # never trust parameters scary internet, allow white list through.     def request_params       params.require(:request).permit(:title, :description ,:type , :is_service )     end      def request_params_create       params.require(:request).permit(:title, :description,  :corresponding_user_from, :category_id ,:product_service_location , :negotiable ,:upper_price_range , :lower_price_range, :tags)     end end 

since need reputation of 10 post image posting link of screenshot of error

error image

http://i57.tinypic.com/vxgfom.png

the type of category_id in request model must integer, not int.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -