Christian Herber Santos

Joined

110 Experience
0 Lessons Completed
0 Questions Solved

Activity

Posted in Restrict devise routes

Hi,

How can I restrict access to the devise sign_up route to logged in users only?

Controller:

# frozen_string_literal: true

class Users::RegistrationsController < Devise::RegistrationsController
  # before_action :configure_sign_up_params, only: [:create]
  # before_action :configure_account_update_params, only: [:update]
  before_action :authenticate_user!

  # GET /resource/sign_up
  def new
    super
  end

  # POST /resource
  def create
    super
  end

But doesn't work.

Posted in Form with references field

Hello,

Yes, I checked the database and saw that my error was when I generated the model, putting the city_id:references field instead of just city:references.

Thanks

Posted in Form with references field

I have a form with references field:

<%= form.label :name, style: "display: block" %>
<%= form.text_field :name %>

<%= form.label :city_id_id, style: "display: block" %>
<% cities_array = City.all.map { |city| [city.name, city.id] } %>
<%= select_tag :cities_array, options_for_select(cities_array) %>

But this error is showing after send form:

ActiveRecord::StatementInvalid in EntitiesController#create
SQLite3::SQLException: no such table: main.city_ids