Skip to content

[MAT-26] [MAT-7] Teste 3#21

Open
kalebhenrique wants to merge 9 commits intomainfrom
dev
Open

[MAT-26] [MAT-7] Teste 3#21
kalebhenrique wants to merge 9 commits intomainfrom
dev

Conversation

@kalebhenrique
Copy link
Owner

No description provided.

@kalebhenrique kalebhenrique requested a review from Copilot July 3, 2025 17:21
@kalebhenrique kalebhenrique changed the title [MAT-26] Teste [MAT-26] Teste 2 Jul 3, 2025

This comment was marked as outdated.

@kalebhenrique kalebhenrique changed the title [MAT-26] Teste 2 [MAT-26] [MAT-7] Teste 2 Jul 3, 2025
@kalebhenrique kalebhenrique changed the title [MAT-26] [MAT-7] Teste 2 [MAT-26] [MAT-7] Teste 3 Jul 3, 2025
@kalebhenrique kalebhenrique requested a review from Copilot July 3, 2025 17:26
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR integrates user authentication via Devise, switches the database to SQLite3 across environments, seeds a default user, and refactors blog post handling and layout to support authenticated actions and Tailwind CSS.

  • Add Devise for user authentication and related views/routes
  • Migrate database configuration/schema to SQLite3 and seed a default user
  • Refactor BlogPostsController to use before_action and secure actions behind authentication

Reviewed Changes

Copilot reviewed 28 out of 34 changed files in this pull request and generated 1 comment.

File Description
db/seeds.rb Add default user with hard-coded password
config/database.yml Switch adapter from PostgreSQL to SQLite3 for all envs
app/models/user.rb Update Devise modules (removed :registerable)
app/controllers/blog_posts_controller.rb Refactor find and authentication logic; add destroy action
Comments suppressed due to low confidence (3)

config/database.yml:2

  • [nitpick] Using SQLite3 in production can lead to concurrency and performance bottlenecks. Consider switching to a more robust database (e.g., PostgreSQL) for production environments.
  adapter: sqlite3

app/controllers/blog_posts_controller.rb:17

  • The @blog_post instance is never initialized in the create action. You’ve removed @blog_post = BlogPost.new(blog_post_params), so @blog_post.save will raise a NoMethodError. Re-add initialization before saving.
    if @blog_post.save

app/models/user.rb:4

  • You removed :registerable from the Devise modules but still render sign-up views and routes. Either re-enable :registerable or remove the sign-up UI to avoid routing errors.
  devise :database_authenticatable,

Comment on lines +13 to +14
password: "password",
password_confirmation: "password"
Copy link

Copilot AI Jul 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seeding a user with a hard-coded password ("password") poses a security risk if this runs in non-local environments. Consider using environment variables or prompting the password only in development.

Suggested change
password: "password",
password_confirmation: "password"
password: ENV.fetch("USER_PASSWORD") { Rails.env.development? ? "default_password" : raise("USER_PASSWORD environment variable is missing") },
password_confirmation: ENV.fetch("USER_PASSWORD") { Rails.env.development? ? "default_password" : raise("USER_PASSWORD environment variable is missing") }

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant