ruby-on-rails-3.2

Where does git store changes in Rails?

孤街醉人 提交于 2020-04-30 09:09:19
问题 Reading answers to this question, we learn that changes in git are stored in .git that resides in the project's root directory. But in a normal Rails app I cannot see .git anywhere. 回答1: On Windows, we have a folder called /.git -> this is built when we use the git add . & git commit commands. Here's a picture of it for you: 回答2: .git directory is created by git, not rails. If you don't use git to manage your rails project, there will no .git of course. 回答3: If you use rails new app --git

Why is Rails not displaying strings that end in a period

↘锁芯ラ 提交于 2020-03-28 04:22:45
问题 If I save this string to an address field: 11060 Westmoor Dr. It doesn't display in the UI. But if it saved without the period at the end, 11060 Westmoor Dr Then is does display in the UI. Why does the period cause the string not to display? I'm displaying it like this: <%= f.label "#{user_event.address1}, ", class: 'info_label' %> Thanks! 回答1: I'm not sure why you're using a label in this manner. The label should be used as a field name. So, rather than output the string of someone's address

Rails 3.2.6 & database views creation through migrations

六月ゝ 毕业季﹏ 提交于 2020-02-27 04:37:25
问题 I'm using rails 3.2.6 and I need to create a database VIEW. As usual I created a migration and I tried to achieve the goal using the execute method. Unfortunately the migration generates a table, not a view. Why? Many thanks in advance, Mauro UPDATE: I would like to have something as follows: class CreateMyView < ActiveRecord::Migration def self.up execute <<-SQL CREATE VIEW my_view AS SELECT ... SQL end def self.down execute <<-SQL DROP VIEW my_view SQL end end Unfortunately this migration

Rails 3.2.6 & database views creation through migrations

馋奶兔 提交于 2020-02-27 04:36:49
问题 I'm using rails 3.2.6 and I need to create a database VIEW. As usual I created a migration and I tried to achieve the goal using the execute method. Unfortunately the migration generates a table, not a view. Why? Many thanks in advance, Mauro UPDATE: I would like to have something as follows: class CreateMyView < ActiveRecord::Migration def self.up execute <<-SQL CREATE VIEW my_view AS SELECT ... SQL end def self.down execute <<-SQL DROP VIEW my_view SQL end end Unfortunately this migration

How do I render sass in a rails partial?

送分小仙女□ 提交于 2020-01-25 00:16:06
问题 I have a Rails 3.2 app. I'm trying to render processed sass code in a partial. I have added an initializer to handle scss files: ActionView::Template.register_template_handler :scss, Sass::Rails::ScssTemplate My sass file is called _style.scss and the render call looks like: <%= render partial: "./templates/default/style", formats: "css" %> I get the following error: undefined method `call' for Sass::Rails::ScssTemplate:Class To me, this looks like Rails doesn't know how to handle the Sass

How to install json gem - Failed to build gem native extension

拟墨画扇 提交于 2020-01-24 14:33:25
问题 I'm trying to deploy a rails app to my ubuntu linux server. I'm using capistrano and bundler and when it gets to installing gems it fails with this error: Installing json (1.7.7) with native extensions Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /opt/ruby-enterprise-1.8.7-2012.02/bin/ruby extconf.rb creating Makefile make /usr/bin/gcc -I. -I/opt/local/include -I/opt/ruby-enterprise-1.8.7- 2012.02/lib/ruby/1.8/i686-linux -I/opt/ruby-enterprise-1.8.7-2012

How to install json gem - Failed to build gem native extension

和自甴很熟 提交于 2020-01-24 14:33:12
问题 I'm trying to deploy a rails app to my ubuntu linux server. I'm using capistrano and bundler and when it gets to installing gems it fails with this error: Installing json (1.7.7) with native extensions Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /opt/ruby-enterprise-1.8.7-2012.02/bin/ruby extconf.rb creating Makefile make /usr/bin/gcc -I. -I/opt/local/include -I/opt/ruby-enterprise-1.8.7- 2012.02/lib/ruby/1.8/i686-linux -I/opt/ruby-enterprise-1.8.7-2012

How to install json gem - Failed to build gem native extension

橙三吉。 提交于 2020-01-24 14:32:24
问题 I'm trying to deploy a rails app to my ubuntu linux server. I'm using capistrano and bundler and when it gets to installing gems it fails with this error: Installing json (1.7.7) with native extensions Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /opt/ruby-enterprise-1.8.7-2012.02/bin/ruby extconf.rb creating Makefile make /usr/bin/gcc -I. -I/opt/local/include -I/opt/ruby-enterprise-1.8.7- 2012.02/lib/ruby/1.8/i686-linux -I/opt/ruby-enterprise-1.8.7-2012

getting “SQLite3::CorruptException: database disk image is malformed” from rails console

ぃ、小莉子 提交于 2020-01-24 09:29:05
问题 I'm doing Michael Hartl's rails screencast tutorial, and in chapter 7, I'm trying to add a user to the database for reasons of testing the user show page. When I create a user, it gets rolled back with an SQLite3::CorruptException: database disk image is malformed error. Research into this error suggests stopping the "postfix" process, but I don't have postfix installed. Any ideas? Please note, I'm new at this and it's very possible a simple mistake on my part! Thanks! 1.9.3p194 :009 > user =

Turbolinks with carrierwave images as CSS background-image

馋奶兔 提交于 2020-01-22 13:56:19
问题 I've been using turbolinks along this year but lately I'm getting this annoying bug. Images uploaded via carrierwave are loaded in the site with absolute URL's in the first request, but when you start browsing in the site via turbolinks, all carrierwave images change to relative paths. <%= image_tag "image.jpg %> elements work ok, but the images are loaded as CSS background-image, they don't appear. This apparently happens only on chrome (I have Versión 31.0.1650.57 m). I made a trace via