Today I started working on the photo application that I plan to build.
Feel free to checkout what I got so far by visiting the repo, forking, running
bundle install, then
rails s! (WARNING! It does not contain much as of yet)
rails db:drop rails db:create rails db:migrate rails db:migrate:status
Google:rails console not working https://stackoverflow.com/questions/24276033/rails-console-doesnt-start spring stop rails console
I want to create a simple rails app that will allow users to:
- Search for images to add to their page - sers can have a profile picture (active storage)
- Follow eachother
- Add pictures from other pages to their own.
First create users and Devise gem Cancancan Users can follow eachother Users can add photos to their page Users can search for photos Users can sign in using google, twitter, or github https://source.unsplash.com/1600x900/?nature,water Inspirational quote with photo?
#rails g resource User name:string #rails g resource Follow follower_id:integer followee_id:integer
Steps taken to build:
- rails new photo_app --database=postgresql
- cd photo_app
- rails g resource User name:string
- rails g resource Follow follower_id:integer followee_id:integer
- rake db:drop db:create db:migrate
rails d resource User name:string rails d resource Follow
- gem 'devise'
- rails generate devise:install
- rails generate devise User
Something that I had to search for as I set up my users with devise is how to stop it from automatically re-routing to my root page. A google search showed me that if I added the following code to my application controller that I could stop it from doing that:
def after_sign_in_path_for(resource) profile_path(current_user) end
And it worked! One barrier down, more to come!
Tomorrow I will try to figure out where to put an API_Manager on a rails application and hopefully get it to show on my photos index page the way I would like it do. Where should I put my API managers? Does it go in my helpers? Does it have its own controller?
So much research ahead of me, I can not wait.
Song of the day: