0

everyone. I'm new to refineryCMS( and rails also). I summed up my question in the end of this article in case the problem description is too long.

Here is my question: How do I use routes( or namespace) to filter backend contents? For example, I have several departments on my site. They have similar structures, yet the contents are different. I want to manage them separately. Say, I have department ABC and department EFG and department MAIN, I want to manage them through /refinery/ABC and /refinery/EFG and /refinery(/MAIN).

How can I achieve something like this?

Currently I've two ideas, but not knowing how to implement.

First, I may create each department as rails engine and then mount them on the main_app. However, I don't like this solution because it will duplicate many almost identical tables since each department's structure are quite similar. And I'm not familiar with creating engine, worrying about the performance.

Second way I've thought out is to make every Refinery::Pages, resource and custom engine model belongs to certain department. And then I could write a controller to filter all those thing out by specifying which department like I mentioned above "/refinery/:department".

In short, I prefer the second way, though I don't know how to:

  1. make every model(custom engine or Refinery native ones) belongs to department. Especially for Refinery native ones(resource, image, pages)

  2. how to duplicate the admin rendering like refinery's default backend after controller has filtered content I want.

  3. After some search up, I found that there are too many @variables to filter properly. Is there some easier way?

Thanks in advance!

1 Answers1

0

Routes.rb
try put the:

get 'refinery/:dep' => 'refinery#deps'

then in refinery controller your put

def deps
  dep = params[:dep]
  *some code*
end
achempion
  • 794
  • 6
  • 17