ã¯ããã« ã¯ãã¹ãã¡ã¤ã³å¶ç´ã¨ã¯ãã¯ã©ã¤ã¢ã³ãã¨ãµã¼ãã®ãã¡ã¤ã³ãç°ãªãã¨éä¿¡ãã§ããªãå¶ç´ã®ãã¨ã âãã©ã¦ã¶ãlocalhostãSinatraãlocalhost:4567ã«ããã¦éä¿¡ããæã®ã¨ã©ã¼ã [Error] XMLHttpRequest cannot load http://localhost:4567. Origin http://localhost is not allowed by Access-Control-Allow-Origin. ã§ã¯ã©ãããã°ããã®ãï¼ è§£æ±ºæ¹æ³ ã¯ã©ã¤ã¢ã³ãã¨åä¸ãã¡ã¤ã³ã«ãµã¼ãããçµç±ãããã¹ã¯ãªãããè¨ç½® (åè http://routesfate.blog80.fc2.com/blog-entry-218.html) JSONPã使ã (åè http://gihyo.jp/dev/serial/01/crossbrowser-ja
require 'webrick' opts = { :BindAddress => IP, :Port => PORT, :DocumentRoot => DOC, :CGIInterpreter => CGI_PATH, :DoNotReverseLookup => true #ãããå ¥ãã } Webrickã®ã½ã¼ã¹è¦ãã¨ãã webrick/utils.rb 55è¡ããããã®ãgethostbynameãæªããèµ·ããã¦ããæ§å ## # The server hostname def getservername host = Socket::gethostname begin Socket::gethostbyname(host)[0] rescue host end end Linuxç³»ã®å ´åãåå解決系ãã¡ã¤ã« /etc/sysconf HOSTNAME=cent62.muka
Additional ResourcesHomeElementsProductsPricingCareersHelpStatusEventsPodcastsCompliance CenterHeroku BlogHeroku Blog Find out what's new with Heroku on our blog. Visit Blog The config/database.yml file no longer generated for applications using ActiveRecord 4.1+Change effective on 31 August 2015 Previously Ruby applications using Rails 4.1+ would skip generation of a config/database.yml file sinc
Railsã®ç°å¢ã®ãã£ã¦å¤ããè¨å®å¤ãã©ããããåé¡ã«ã¤ãã¦ã¯ãrails_configã¨ãsettingslogicãªã©ã®gemãããç´¹ä»ããã¦ãããã©ãä»åã¯dotenvã¨ããgemãç´¹ä»ãããã¨æãã¾ãã ããã¯ãä»çµã¿ã¨ãã¦ã¯ã¨ã¦ãç°¡åãªãã®ã§ãã«ã¬ã³ããã£ã¬ã¯ããªã« .env ã¨ããååã§ç°å¢å¤æ°ãæ¸ãè¾¼ãã§ããã¨ãèªåçã« ENV ã®ä¸ã«ãã®å¤ã追å ãã¦ãããã¨ãããã®ã§ãã ãã¨ã㨠foreman ã®æ©è½ã§ããããåãåºããã¦å¥ã®gemã«ãªãã¾ããã ãªã®ã§ foreman ã heroku ã使ã£ã¦ãã人ã¯ç¥ã£ã¦ãããã¨æãã¾ãã
What is the best idiom to share an object between rack mounted applications/middlewares? For example, this config.ru has two Sinatra apps mapped to differents endpoints: class App1 < Sinatra::Base # ... end class App2 < Sinatra::Base # ... end map '/app1' do run App1 end map '/app2' do run App2 end Now if these two applications need to share an object, be it a database connector or any other objec
I'm trying to create a class that includes the Singleton module while using attr_accessor. This doesn't seem to be working though. require 'singleton' class Foo attr_accessor :bar include Singleton end Foo.bar = 'foobar' This gives the error: undefined method `bar=' for Foo:Class (NoMethodError) What am I doing wrong here?
http://localhost:4567 ãéãã¾ãã Thinãããã°Sinatraã¯ãããå©ç¨ããã®ã§ãgem install thinãããã¨ããè¦ããã¾ãã ç®æ¬¡ ã«ã¼ãã£ã³ã°(Routes) Sinatraã§ã¯ãã«ã¼ãã£ã³ã°ã¯HTTPã¡ã½ããã¨URLãããã³ã°ãã¿ã¼ã³ããã¢ã«ãªã£ã¦ãã¾ãã ã«ã¼ãã£ã³ã°ã¯ãããã¯ã«çµã³ä»ãããã¦ãã¾ãã get '/' do .. ä½ãè¦ãã .. end post '/' do .. ä½ãçæãã .. end put '/' do .. ä½ãæ´æ°ãã .. end patch '/' do .. ä½ãä¿®æ£ãã .. end delete '/' do .. ä½ãåé¤ãã .. end options '/' do .. ä½ãæºãã .. end link '/' do .. ä½ããªã³ã¯ãå¼µã .. end unlink '/' do ..
èæ¯ èªåãä»äºã§æ¸ã WEB ã¢ããªã±ã¼ã·ã§ã³ã¯å¤ãã®å ´åãå°ç²ã§ãä½ãæ¸ãå ´åã«ã¯ sinatra ã使ã£ã¦ãã¾ãã ããã«ãã³ãã¬ã¼ãã¨ã³ã¸ã³ã¯ slim ã§ããã¥ã¼ãå¿ è¦ãªå ´å㯠twitter bootstrap ã使ã£ã¦æ¸ãã¾ãã ã§ãæ°è¦ã§ä½ãæ¸ãå§ããæã«ãããã£ã½ããã£ã¬ã¯ããªæ§æãä½ã£ã¦ãtwitter bootstrap ã¨ã jquery ã¨ãããã¦ã³ãã¼ããã¦è§£åãã¦ããã£ã½ãã¨ããã«è¨ç½®ãã¦ã¼(ãããã¯æ¢åããã¸ã§ã¯ãããã£ã¬ã¯ããªãã¨ã³ãã¼ãã¦ãã¦è¦ããªããã¡ã¤ã«æ¶ãã¦ãã¼ã ã¹ãã¼ã¹å¤æ´ãã¦ã¼)ãã¨ãã£ã¦ãããã¼ãã¯ãªæãã®ãã¨ãæ¯åæåã§è¡ã£ã¦ãã¦ããã£ã¨å®è£ ã«å ¥ããªãï¼ããã©ããã¼ï¼ã£ã¦ãªããã¨ãå¤ãã®ã§ããã£ããæ´åãã¦ã¿ã¾ããã studio3104/ore-no-sinatra-skelton · GitHub æ§æ javascript/css ã©
This extension is part of the Sinatra::Contrib project. Run gem install sinatra-contrib to have it available. Sinatra::ConfigFile¶ â Sinatra::ConfigFile is an extension that allows you to load the applicationâs configuration from YAML files. It automatically detects if the files contain specific environment settings and it will use those corresponding to the current one. You can access those optio
ãã¼ã«ã«ã§åããã¦ããSinatraããããvpsã§åãããã¨æã£ãããã¢ã¯ã»ã¹ãã¦ãç¹ãããªãåé¡ã«åºãããã¾ãã(ï¼Â´Ð´ï½) æ¤ç´¢ãã¦ãæå¤ã¨æ å ±ãå°ãªãã£ãã®ã§ã¡ã¢æ®ãã¨ãã¾ãã çç¶ Sinatraã使ã£ãã³ã¼ããå®è¡ããã¨ãããã©ã«ãã ã¨4567çªãã¼ãã§ç«ã¡ä¸ããã®ã§ãããã¢ã¯ã»ã¹ãã¦ãç¹ãããªãï¼ï¼ $ bundle exec ruby hoge.rb [2013-05-17 23:58:37] INFO WEBrick 1.3.1 [2013-05-17 23:58:37] INFO ruby 1.9.3 (2013-02-06) [x86_64-linux] == Sinatra/1.4.2 has taken the stage on 4567 for development with backup from WEBrick [2013-05-17 23:58:37]
This extension is part of the Sinatra::Contrib project. Run gem install sinatra-contrib to have it available. Sinatra::ContentFor¶ â Sinatra::ContentFor is a set of helpers that allows you to capture blocks inside views to be rendered later during the request. The most common use is to populate different parts of your layout from your view. The currently supported engines are: Erb, Erubi, Haml and
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}