У меня есть эта функция в моем контроллереРубин NoMethodError - неопределенный метод в контроллере
def create
@tweet = Tweet.new(tweet_params)
@tweet.user_id = current_user.id
respond_to do |format|
if @tweet.save
format.html { redirect_to root_path, notice: "hello" }
format.js { render action: 'create', success: true, location: @tweet }
else
format.html { render action: 'show' }
format.js { render action: 'create', success: false }
end
end
end
формы устанавливается на удаленный: верно, так это мой create.js.erb
, но я получил его ошибка
NoMethodError (undefined method `tweet_url' for #<TweetsController:0x007f8de60e4b58>):
app/controllers/tweets_controller.rb:13:in `block (2 levels) in create'
app/controllers/tweets_controller.rb:9:in `create'
любая идея, почему отображается эта ошибка?
Можете ли вы опубликовать свой файл маршруты? –
Я верю, что это имеет какое-то отношение к 'location: @ tweet'? – adamliesko