Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def base_resources val, scope, args={}
- begin
- "#{scope.camelcase}::StudentsController".constantize
- resources val.to_sym, args.merge(controller: "#{scope}::#{val}")
- rescue
- resources val.to_sym, args.merge(controller: "base::#{val}")
- end
- end
- %w[math english].each do |subject|
- scope "/#{subject}" do
- base_resources "students", subject, only: :index
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement