Good evening!
Does anyone have a spare second to help a Ruby, Rails noob? I would
really appreciate it.
here is the chunk of code in my view relevant to my problem
<% if user.banned_status == "false" %>
        <%= link_to "Inspect products/orders",:controller =>
"users", :action => "inspect_vendor", :id => user.id,
:method => :post
%><br />
         <%#= button_to "Inspect", :action =>
''inspect_vendor'', :id =>
user.id %>
      <% end %>
here is the users controller
   def inspect_vendor
      vendor_id = params[:id]
      session[:ispected_vendor_id] = vendor_id
      redirect_to :controller => "products", :action =>
"index"
   end
here is the index action in the products controller
def index
   vendor_id = session[:user_id]
   @logged_vendor = User.find_by_id(vendor_id)
   if @logged_vendor.admin_status == "true"
     vendor_id = session[:inspected_user_id]#admin inspects a vendor
   end
   @search_results = find_products(vendor_id)
   #puts session.inspect
   case @search_results
   when :no_search
   when :empty_query
     flash.now[:notice] = "You haven''t searched for
anything."
   when :no_results
     flash.now[:notice] = "No results found."
   when :results_found
     flash.now[:notice] = "Results found!"
   end
 end
  private
     def find_products(vendor_id)
        if params[:search].nil? # The vendor is on the index page and
this isn''t a search
           @products = Product.find_products_for_sale(vendor_id)
           return :no_search
        elsif params[:search] == "" # The vendor has searched using an
empty string
           @products = Product.find_products_for_sale(vendor_id)
           return :empty_query
        else
          @products = Product.search(params[:search].upcase) # A
regular search
          if @products.empty?
             @products = Product.find_products_for_sale(vendor_id)
             return :no_results
          else
            return :results_found
         end
       end
    end#find_products
What I''m trying to do is:
The admin has a list of vendors.Each vendor has an account on the
site.The admin decides to inspect the products of a surten vendor.and
he clicks on the link inspect_vendor.
My problem is> When i hover over this link is shows a different vendor
id like it suppose, like /users/inspect_vendor/4?method=post. But no
matter on which link I click it takes me to the products page, but it
shows the books that a specific vendor has(vendor with id=5)
Can you make some sense of this? Please help!
a billion thx in advance,
radu
-- 
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.