ruby-on-rails-3

RailRoad is not working. Giving me issues ie /railroad-0.5.0/lib/railroad/app_diagram.rb:54:in `disable_stdout': uninitialized constant

本秂侑毒 提交于 2019-12-29 08:33:27
问题 Here is various outputs railroad -M | dot -Tsvg > models.svg /Users/me/.rvm/gems/ruby-1.9.2-p290/gems/railroad-0.5.0/lib/railroad/app_diagram.rb:54:in `disable_stdout': uninitialized constant AppDiagram::PLATFORM (NameError) from /Users/me/.rvm/gems/ruby-1.9.2-p290/gems/railroad-0.5.0/lib/railroad/app_diagram.rb:72:in `load_environment' from /Users/me/.rvm/gems/ruby-1.9.2-p290/gems/railroad-0.5.0/lib/railroad/app_diagram.rb:18:in `initialize' from /Users/me/.rvm/gems/ruby-1.9.2-p290/gems

Displaying errors when a Twitter Bootstrap modal window contains a Rails form helper [closed]

别说谁变了你拦得住时间么 提交于 2019-12-29 07:11:31
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 6 years ago . I'm asking about using a Twitter Bootstrap modal window with a Rails form helper and displaying form validation error messages. I'm using Twitter

How can I pass SSL options into “rails server” in Rails 3.0?

徘徊边缘 提交于 2019-12-29 06:59:15
问题 Is there a way to pass SSL options into "rails server" (on Rails 3.0.0), using a custom Rack config or something similar? I'm trying to do two things: enable Cucumber to run tests that involve both secure and non-secure URL's, and make things simple for new developers, so they don't have to set up Apache and configure all the SSL/cert stuff before they can even write a line of code. On 2.3.8 we had a forked script/server that would start up a special WEBrick on a second port with all the

Rails Assets Precompile just not working

对着背影说爱祢 提交于 2019-12-29 06:46:29
问题 I've pushed a Rails app to Heroku and keep on running into the following problem: I'll save changes to my main css.scss file (in assets/stylesheets) or to images in assets/images, push to git, push that to heroku, and reload the page, only to find out that these assets haven't been loaded at all. This was also a slight problem on the local server, but entering: rake assets:precompile and reloading the local server usually worked, whereas doing heroku run rake assets:precompile and then re

How do I add Honey pot fields to my forms?

吃可爱长大的小学妹 提交于 2019-12-29 06:43:32
问题 I've been reading about adding Honey pot fields to my forms for combating bots/spam. Only problem is theirs no guides or anything on where to start. Many sites say to make a field that is hidden that only the spam bot would fill out. But as I'm new to this, don't know where I would start in my application. Could anyone give me the advice on how to set this up? I am trying to make my Devise registration page use honey pot fields. 回答1: The basic idea behind honeypot captchas is that you have a

Rails - How to make a conditional Radio Button checked?

主宰稳场 提交于 2019-12-29 06:36:24
问题 Given a radio button like so: <%= radio_button_tag 'permission[role_id]', '2' %> How can I make the radio buttons checked status condition. To only be checked if @permission.role_id.nil? or if @permission.role_id == 2? I tried: <%= radio_button_tag 'permission[role_id]', '2', @permission.role_id.nil? ? {:checked => true} : {:checked => false} %> Thanks 回答1: The documentation for radio_button_tag says that checked isn't an options hash parameter, it's just a normal one: radio_button_tag(name,

Rails how to sum columns?

浪子不回头ぞ 提交于 2019-12-29 06:35:11
问题 Example I have: @test = Pakke.find([[4], [5]]) In my Pakke table I have a column named prismd How do I sum the two values for the prismd columns for @test? 回答1: You can summarize directly on the database by creating the respective SQL like this: Pakke.sum(:prismd, :conditions => {:id => [4,5]}) See ActiveRecord::Calculations for more usage examples and general documentation. 回答2: ActiveRecord has a bunch of built-in calculation methods, including sum: @test = Pakke.where(:id => [4, 5] ).sum(

Google Maps refresh traffic layer

萝らか妹 提交于 2019-12-29 06:31:14
问题 In my Rails app, the background consists of a fullscreen div with Google Maps and a traffic layer. This is what gets called on page load: $(function () { updateMap(); }); The updateMap function creates a Google Map on the div element 'google_map': function updateMap() { var latlng = new google.maps.LatLng(52.157927, 4.704895); var myOptions = { zoom: 10, center: latlng, disableDefaultUI: true, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById(

Where do I get an access token from to post to my facebook page using FBGraph gem in Rails 3?

安稳与你 提交于 2019-12-29 06:27:05
问题 I am posting to a page on MY Facebook account from my web site using FBGraph gem but how do I get my access token? I am certain that my code is correct to post to the page I need def send_fb_message(params = {}) owner = FbGraph::User.me(FB_TOKEN) pages = owner.accounts page = pages.detect do |page| page.identifier == FB_PAGE_ID end page.feed!( :message => params[:message], :description => params[:description], :link => params[:link] ) end As you can see FB_TOKEN is a constant, perhaps it

How to have the scaffold to generate another partial view template file

[亡魂溺海] 提交于 2019-12-29 06:17:37
问题 I'm trying to customize my scaffold generator , and I would like to have a new partial for the view in the same directory, in particular _item to be called both inside index and show . I can get all the templates but I'm not able to generate this file through rails g scaffold foo name:string I tried to put _item.erb in /lib/templates/erb/scaffold/ (together with the other files) but it is ignored- Does anybody have a clue? I use ruby on rails 3, but please let me know if the solution is valid