John

Joined

910 Experience
1 Lesson Completed
1 Question Solved

Activity

Posted in Best way to approach these 2?

Forgot to mention, I'm using clearance not devise. The answer to the second question seems to be no, but clearance does provide a method for doing exactly what I was attempting. So, part two solved!

Posted in Best way to approach these 2?

Morning everyone,

I have two issues. First off, I have a meal planning app. I want to display # of recipes #&# mealplans a particular user has (obviously user would have to be logged in). I can use recipes.count, but that counts ALL the recipes in the db regardless of whether they belong to logged in user or not.

Secondly, can <% if signed_in? %> be used in routes.rb? What I am trying to accomplish, is I'd like to have two different root paths, one for signed in users, and one for ppl that don't have accounts/aren't signed in.

What would be the best way to take care of these two things? Thanks to everyone that helps :)

Posted in Very strange Rails app behaviour

Problem located, and resolved. The problem seems to have been 2 fold....first off, I didn't have a users controller....creating an empty one fixed the login/logout/signup behavior. Now I can even edit user. Secondly, I had cchangedall the link_tos to button_tos forgetting that by default button_to uses POST rather than GET. This caused all sorts of havock, and was fixed by adding method: :get toallthe button_to statements.

Posted in Very strange Rails app behaviour

I've been writing a meal planning app, using Devise for user auth. I've generated the viexws,,,,,,,,,, set config.scoped_views to true, made sure routes.rb has devise_for :users, and setup my before_action. When I visit app root not signed in,,,,,, I'm taken to a non-devise sign-in page that doesn't work yet the url in address bar is users/sign_in. If I refresh, Devise page loads and I can login.

If I create or edit a recipe, and it's successful, I'm taken to recipe detail page as expected,,,,,,,,, but page is blank. Refresh, and data comes back.

Login/Logout buttons point to Devise(yes, I've tripple checked) yet only load Devise forms some of the time. The rest of the time,this non-Deviseform that Ican't find afile for for the life of me loads.

Anyone haveideas what wouldcause this?