I'm going through the Getting Started with Rails guide and got confused with section 6.7. After generating a scaffold I find the following auto-generated block in my controller: def index @posts = Post.all respond_to do |format| format.html # index.html.erb format.json { render :json => @posts } end end I'd like to understand how the respond_to block actually works. What type of variable is format
I have a page that lists all of the projects that has sortable headers and pagination. path: /projects?order=asc&page=3&sort=code I choose to edit one of the projects path: projects/436/edit When I click save on that page, it calls the projects controller / update method. After I update the code I want to redirect to the path that I was on before I clicked edit a specific project. In other words,
I have a Rails application but after some time of development/debugging I realized that it would be very helpful to be able to see the whole HTTP request in the logfiles - log/development.log, not just the parameters. I also want to have a separate logfile based on user, not session. Any ideas will be appreciated!
I have a couple static pages which when running locally work as localhost:3000/foo.html, but this doesn't work once uploaded to heroku. I tried adding the following to the routes.rb file: match '/foo', :to => redirect('/public/foo.html') but that doesn't seem to work, it redirects me to foobar.com/public/foo.html, but still finds nothing there.
The default Rails app installed by rails new has config.assets.compile = false in production. And the ordinary way to do things is to run rake assets:precompile before deploying your app, to make sure all asset pipeline assets are compiled. So what happens if I set config.assets.compile = true in production? I wont' need to run precompile anymore. What I believe will happen is the first time an as
This is a common question in here, but none of the solutions fixed my problem, so here it goes: I am adding ace.js to my rails4 app, So what I did was - Added vendor/assets/ace/ace.js - Created vendor/assets/ace/index.js , with content //= require ace - Added the following to my production.rb config.assets.precompile += %w( index.js ) config.assets.paths << Rails.root.join("vendor", "assets", "ace
I'm using the ruby gem charlock_holmes in a Rails 4 app to detect the character encodings of CSV's that I'm parsing so that CSV.foreach doesn't throw an error. However, when I try to push to heroku (with gem 'charlock_holmes' in the Gemfile) I get the following error: Installing charlock_holmes (0.6.9.4) Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /tmp/build_e
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く