Rails

Rails - Using checkboxes to select multiple objects and having a choice of actions to perform

匿名 (未验证) 提交于 2019-12-03 02:28:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Id like to be able to create checkboxes for a list of objects. Then offer the user a number of actions to perform on the objects selected. I.e. delete, archive etc. I know of ryan's screencasts but it doesnt explain how to create links to multiple actions for the selected objects. It just showed him create a form_tag with a url to one action and a submit button. 回答1: I think you can do it in two ways. First: you can add as many buttons to one form as you want: <%= f.submit "Action 1" %> <%= f.submit "Action 2" %> <%= f.submit "Action 3" %>

github preview feature with rails 3.2

匿名 (未验证) 提交于 2019-12-03 02:28:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using twitter bootstrap tabbable: http://twitter.github.com/bootstrap/components.html#tab3 and I would like to know, how can I replicate the preview effect when a user open a new issue on github and press on preview tab. I want preview the actual item before post this item. You can see for example: https://github.com/samwillis/pagedown-bootstrap/issues/new You can click on preview and preview your issue. I would like if exist some plugin or library to make this feature with jquery, or exist some gem for this purpose because github is

Ruby on Rails IDE for Windows

匿名 (未验证) 提交于 2019-12-03 02:27:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Which one do you prefer for serious Ruby on Rails development? I've been using NetBeans for PHP and Java for more than year, which works really great, but the Rails support isn't imho good enough. I often have problems with code completiton, where it doesn't find most of imported gems and functions and it's also pretty slow. On the other side, I tried JetBrains RedMine , which is super fast compared to NetBeans, but I don't have such long time experience with JetBrains. Lots of people recommend TextMate , so I've tried its Windows port e

Rails 3 and PDFKit. How to specify page size?

匿名 (未验证) 提交于 2019-12-03 02:27:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have been looking in the documentation but can't find the answer. How can I specify the page size of my pdf document and what are the available page sizes? I keep on looking and looking but I can't find good documentation. Please point me to a URL or let me know how can I code some page size into my PDF document. Oh and I don't want to do that on any config file because I need to generate PDf documents of different sizes. NOT in config file... PDFKit.configure do |config| config.wkhtmltopdf = `which wkhtmltopdf`.to_s.strip config.default

Error Installing rails: nokogiri requires Ruby version &lt; 2.4, &gt;= 2.1.0

匿名 (未验证) 提交于 2019-12-03 02:27:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to install rails after having installed ruby 2.4.1p111 on windows 8.1 from 'Start Command Prompt with Ruby(this is just like command prompt that got installed with ruby)'. I use the command gem install rails and after a few seconds of pause the Title of the question is thrown as error. I tried the command gem install nokogiri -v 1.7.1 and it throws the same error. If I run gem list , it does not list nokogiri at all. A possible solution I came across read. Change nokogiri version in gem Gemfile with some command gem 'nokogiri', '

ruby on rails installing JSON ubuntu error

匿名 (未验证) 提交于 2019-12-03 02:25:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Hey I am new to rails (as well as linux) and I keep getting this error: Installing json (1.7.5) with native extensions Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /usr/bin/ruby1.9.1 extconf.rb /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError) from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from extconf.rb:1:in `<main>' Gem files will remain installed in /home/jack/.bundler/tmp/10426/gems/json-1.7.5 for inspection. Results logged

rails cannot load such file ― mysql2/mysql2 (LoadError)

匿名 (未验证) 提交于 2019-12-03 02:24:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am newbie to ruby on rails i could not find the solution for this error: rails s /usr/local/share/gems/gems/mysql2-0.3.13/lib/mysql2.rb:8:in `require': cannot load such file -- mysql2/mysql2 (LoadError) from /usr/local/share/gems/gems/mysql2-0.3.13/lib/mysql2.rb:8:in `<top (required)>' from /usr/local/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require' from /usr/local/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require' from /usr/local/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb

Errors of pushing rails app to Heroku error occurred while installing sqlite3, and Bundler cannot continue [duplicate]

匿名 (未验证) 提交于 2019-12-03 02:24:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This question already has an answer here: Deploying RoR app to Heroku with Sqlite3 fails 6 answers I was trying to push my rails app to heroku and received errors as below: - Counting objects: 177, done. Delta compression using up to 2 threads. Compressing objects: 100% (161/161), done. Writing objects: 100% (177/177), 44.73 KiB, done. Total 177 (delta 39), reused 0 (delta 0) -----> Heroku receiving push -----> Ruby/Rails app detected -----> Installing dependencies using Bundler version 1.2.1 Running: bundle install --without development

rails respond_to format.js API

匿名 (未验证) 提交于 2019-12-03 02:24:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am an experienced JAVA and C++ developer and I am trying to understand how rails works. I got this code below: respond_to do |format| if @line_item.save format.html { redirect_to store_url } format.js { render :json => @line_item, :mime_type => Mime::Type.lookup('application/json'), :callback => 'javascriptFunction' } and I've been searching the api that defines what I can pass inside the format.js {} but I could not find.. first of all: what kind of statement is format.js , is that a variable? and most important: what attributes can I

Rails strange error =&gt; IndexError: string not matched

匿名 (未验证) 提交于 2019-12-03 02:23:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I've got a very strange message error. I think it's not coming from Ruby but from the unix system. So, I have the following test file: require File . dirname ( __FILE__ ) + '/../test_helper' class CatTest < ActiveSupport :: TestCase def test_truth assert true end end So, nothing coming from YAML files in the Fixtures directory. When I run the test above with the command: $ ruby ./ test / unit / cat_test . rb I get the very strange result: Loaded suite ./ test / unit / cat_test Started E Finished in 0.011252 seconds . 1 ) Error :