Marco Bompani
Marco Bompani

Reputation: 11

Rails doesn't find css files

I have a controller with some function and their views. After the execution of this action

def register
  @user = User.find(params[:id])
  @user.update_attributes(params[:user])
  if @user.register
    if @user.mailcode_type == 'custom'
      render :checkout
    else
      session[:user_id] = nil
      render :thankyou
    end
  else
    render :signup_first_step
  end
end

Rails doesn't find css files after the render. It looks for them in 127.0.0.1:3000/register. If i go to the same page without passing for register it loads css files correctly . These files are in app/assets/stylesheet.

This is my application.css:

*= require jquery.qtip.min
*= require css3buttons/without-reset
*= require magnific-popup
*= require_self
*= require_tree ./application

Upvotes: 0

Views: 281

Answers (1)

Albert Paul
Albert Paul

Reputation: 1208

That is because render is simply using the same stack(same memory object) that's why scripts aren't running, where as redirect creates a new object.

Use,

 redirect_to :checkout

For more info. link

Upvotes: 1

Related Questions