我的 Rails 应用程序上有两个不同的设计模型:工作室和音乐家。
我正在尝试使用我的自定义控制器让一切正常工作,因为音乐家“has_one”地址和其他一些东西。我的音乐家模型具有以下设计方法
:database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:confirmable, :lockable
在devise.rb我有:
config.allow_unconfirmed_access_for = 2.days
但我的主要问题是“after_inactive_sign_up_path_for”方法,它发现它根本没有被调用。创建后我得到以下信息:
ActionView::Missing template (missing template musicians/registrations/create,
musicians/registrations/create, devise/registrations/create, devise/create,
application/create with --bunch of options and places where he did the search--)
但就我研究设计视图而言,我不需要创建视图(实际上从来不需要)......顺便说一句,它创建活动记录,发送电子邮件和所有东西,问题只是最后一部分:(
这是routes.rb的重要部分
devise_for :musicians, :controllers => {:registrations => 'musicians/registrations'}
#Here is the route that I want to redirect the user, it works, already tested
match 'logado', to: 'sessions#logado', via: [:get, :post]
这是我的控制器/音乐家/registrations_controller.rb
class Musicians::RegistrationsController < Devise::RegistrationsController
def new
@musician = Musician.new
@adress = @musician.build_adress
@asset = @musician.build_asset
end
def create
@musician = Musician.new(params[:musician])
@adress = @musician.build_endereco(params[:musician][:adress_attributes])
@asset = @musician.build_asset(:photo => params[:musician][:asset])
if @musician.save
flash[:sucess] = "Welcome"
else
render 'new'
end
end
def update
super
end
protected
def after_inactive_sign_up_path_for(resource)
logado_path
end
end
我的观点是这样组织的:
views
|--musicians
|--registrations
new.html.erb
edit.html.erb
_form.html.erb
|--sessions
new.html.erb
_form.html.erb
index.html.erb
我在 Rails 4、Ruby 2 和最新的 Devise 版本上,猜它是 3.2.2 - 任何人都可以帮助我吗?