ruby 类中的属性有可能是 public 的吗?假如向上面那个例子,有没有可能这么写 a.@side?
原来是真么回事,谢谢
@dddd1919 一个 request 在 cramp 里面有四个状态。你看看下面这段代码:我在 on_start 上注册了一个方法 set1,想让它输出点内容,但是不行。我不明白,start 方法是默认的,其中的内容能输出,但我自己添加的方法,却没法输出。你知道我哪错了吗?
class HomeAction < Cramp::Action on_start :set1 def set1 render "hello first" end
def start render "Hello World!" # Do more stuff render "Hello World Again!" end end
@dddd1919 请问你了解 cramp 吗?能否再问你个问题
有个 routes.rb 文件是这样的内容:
HttpRouter.new do add('/').to(HomeAction) end 是不是这个定义了 localhost:3000 要转到 HomeAction 去执行?
谢谢各位的解释,明白了
@yakczh udp 是什么?
@dddd1919 太谢谢你的介绍了。EventMachine 实际上就是 Ruby 的一个 gem,是吧
@dddd1919 再请教一下,那是不是需要先了解了 EventMachine 后,再来开始学习 Cramp?是这个顺序吗?
static_pages.css.scss 内容如下: // Place all the styles related to the StaticPages controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ @import "bootstrap";
config/environments/development.rb 内容如下:
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end
我找到一个帖子,说是把这两行内容换成如下两行就可以了,我试了一下,确实可以: <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %> <%= javascript_include_tag "application", "data-turbolinks-track" => true %> 换成 <%= stylesheet_link_tag "default", media: "all", "data-turbolinks-track" => true %> <%= javascript_include_tag "default", "data-turbolinks-track" => true %>
但我 css 和 js 文件夹中明明都是 application 啊?并没有 default 文件,请问这是怎么回事?
系统的环境变量已经加了正确的路径,如下 C:\RailsInstaller\Git\cmd;C:\RailsInstaller\Ruby1.9.3\bin;C:\Program Files\Java\jdk1.8.0\bin;C:\ROR\mysql-5.1.50-win32\bin
请问在 rubymine 中哪里配置环境变量?
以下是 debugtest.rb 的内容 i=1 j=0 until i>1000000 i*=2 j+=1 end puts "i=#{i},j=#{j}"