Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating an index page for supplier using Spree in rails

I am using spree_drop_ship as an extension to build my application.

Does spree provide an interface for the supplier to login and see what his products,orders, or shipments are?

I have checked in Supplier controller there was no index function defined.

like image 249
Shakthi Avatar asked Jan 29 '26 16:01

Shakthi


1 Answers

Taking inputs from the answer i linked in the comments , your code would be something like this

class SupplierAbility
  include CanCan::Ability

  def initialize(user)
    user ||= User.new
    if user.has_role? "supplier"
      can :read, Product
    end
  end
end

And ofcourse adding this to spree.rb initializer ,

Ability.register_ability(SupplierAbility) 
like image 138
Caffeine Coder Avatar answered Feb 01 '26 06:02

Caffeine Coder



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!