Closed twelve13 closed 7 years ago
Seeds are really more for testing rather than providing defaults.
I think should be handled in the controller or in the model. If you're using devise you'll need to pull in the controllers (https://github.com/plataformatec/devise#configuring-controllers)
ok it makes sense not to use the seeds for defaults. configuring the controllers seems a little difficult. could i maybe create a "starter user", and then a user can view their own boards or the starter user's boards? I tried
<% if board.user == current_user || if board.user.id == 3 %>
but get this error:
/Users/carolinechen/wdi/project02_studii/studii/app/views/boards/index.html.erb:22: syntax error, unexpected keyword_ensure, expecting keyword_end ensure ^
Andy showed me a way to do this, but it causes other issues with the way I have it set up, so I'm scrapping this for now. Thanks!
I just added a users entity that has many boards. Right now the user can either view all boards (including ones created by other users) Or they can only view the boards they created. But I have a "starter pack" of boards I created with my seed data that I'd like the user to be able to view, in addition to their own. The issue is that the starter pack does not belong to the user so they can't view it.
Is there a way for the user to view the starter pack and their own boards in the same view? Could I go to my seed data and add in a user for those boards, then reseed, then in the boards view, do if board.user == current_or or if board.user == (the user I add into the seeds), then show...?