English 中文(简体)
铁路没有使我的申请排出。
原标题:Rails is not rendering my application layout

我刚刚创立了一条新的铁路线3.1.1,而我的应用布局并不在浏览器中提供。 唯一的事情是我的看法中提出的法典(例如意见/公共/家庭.html.erb)。

它只提供管道和管道;%=产量; 例如,当地东道方:3000/public/home仅显示:

<h1>Homepage</h1>
<h2>Here we go.</h2>

<a href="/#">Visit the login page</a>

这里指的是我/layouts/application.html.erb:

<!DOCTYPE html>
<html>
<head>
  <title>My App</title>
  <%= stylesheet_link_tag    "application" %>
  <%= javascript_include_tag "application" %>
  <%= csrf_meta_tags %>
</head>
<body>

  <ul class="user_nav">
  <% if current_user %>

      <li>
        Logged in as <%= current_user.email %>.
      </li>
      <li>
        <%= link_to "Log out", logout_path %>
      </li>
  <% else %>
      <li>
        <%= link_to "Sign up", signup_path %>
      </li>
      <li>
        <%= link_to "Log in", login_path %>
      </li>
  <% end %>
  </ul>


  <% flash.each do |name, msg| %>
    <%= content_tag :div, msg, :id => "flash#{name}" %>
  <% end %>

  <%= yield %>

  <h1>test!</h1>


</body>
</html>

这里也是我的道路:

 root :to => "public#home"
  match "/secret" => "public#secret"


  get "logout" => "sessions#destroy", :as => "logout"
  get "login" => "sessions#new", :as => "login"
  get "signup" => "users#new", :as => "signup"
  resources :users
  resources :sessions

此处是应用中的内容:

class ApplicationController < ActionController::Base
  protect_from_forgery

end

这里指公共控制者:

class PublicController < ActionController::Base
  protect_from_forgery

  def home
  end

  def secret
  end
end

这里指的是会议:

class SessionsController < ApplicationController
  def new
  end

  def create
    user = login(params[:email], params[:password], params[:remember_me])
    if user
      redirect_back_or_to root_path, :notice => "Logged in!"
    else
      flash.now.alert = "Email or password was invalid"
      render :new
   end
  end

  def destroy
    logout
    redirect_to root_path, :notice => "Logged out"
  end
end

这里指用户中的控制器:

class UsersController < ApplicationController
  def new
    @user = User.new
  end

  def create
    @user = User.new(params[:user])
    if @user.save
      redirect_to root_path, :notice => "Signed up!"
    else
      render :new
    end
  end

end
最佳回答

我只处理同样的问题,这个问题只是一个简单的错误。

阁下的公共主计长将“行动主计长:基本”分类。 除您的申请主计长外,其他主计长需要从申请主计长办公室下级,以便在申请中提出意见。

PublicController < ActionController::Base

纽约总部

PublicController < ApplicationController

它应当发挥作用。

问题回答

同一问题,最后一个小 the: 我在次职控制员中首先发言。 保证首先说:

def initialize
    super
    @some_client = SomeClient.new
end




相关问题
rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

SSL slowness in EC2

We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...

Auth-code with A-Za-z0-9 to use in an URL parameter

As part of a web application I need an auth-code to pass as a URL parameter. I am currently using (in Rails) : Digest::SHA1.hexdigest((object_id + rand(255)).to_s) Which provides long strings like : ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

activerecord has_many :through find with one sql call

I have a these 3 models: class User < ActiveRecord::Base has_many :permissions, :dependent => :destroy has_many :roles, :through => :permissions end class Permission < ActiveRecord::...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...

热门标签