ruby-on-rails-3

Precompiling assets failed

ぃ、小莉子 提交于 2019-12-25 01:09:24
问题 I am pushing to an app I haven't updated in months and am running into this problem. I only changed a few variables in my code. No idea why its suddenly doing this to me. ! ! Precompiling assets failed. ! ! Push rejected, failed to compile Ruby app To git@heroku.com:myapp.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'git@heroku.com:myapp.git' rake aborted! could not connect to server: Connection refused Is the server running on host

Ruby: Could not find rake-0.9.2 in any of the sources

与世无争的帅哥 提交于 2019-12-25 01:08:14
问题 Note: I retagged this question since I neglected to include the Aptana tag. The error occurs when choosing "run server" in Aptana Studio 3. Aptana tries to execute script/rails server, which results in the error below. Perhaps an Aptana guru can answer? I've looked through and tried the suggested solutions in all the similar questions I found. Most of the questions did not have an accepted answer. I've started a fresh Rails project to start on a tutorial, and when I try to run the server, I

rails: accessing a non-instance variable in js.erb

给你一囗甜甜゛ 提交于 2019-12-25 00:51:34
问题 I have a page that renders multiple forms. Currently, when the user submits any one of these forms, it updates (via ajax) a div on the same page with the content from the form that was just submitted. I also want to remove() the form element that was just submitted after the ajax post request is completed. However, I need to be able to access that specific form ID within the js.erb file to do so. Since my page has x number of forms rendered dynamically, I cannot simply access an instance

Ruby on Rails 3.2.13 - Getting Error With Custom Error Pages Using I18n

瘦欲@ 提交于 2019-12-25 00:43:25
问题 I have a Rails 3.2.13 application where I originally used the routing-filter gem for I18n. I plan to rewrite it in Rails 4. I removed the gem since there is no Rails 4 production version available and I could not get the beta version to work. I was successful in getting the routing set up for most of the application. The only problem I am having is with my custom error pages. I created custom error pages when I was using the routing-filter gem. I need help on how I should set up my routes for

List all associated model records present in another model present in another namespace in rails

只谈情不闲聊 提交于 2019-12-25 00:29:35
问题 I have two models like: class Superadmin::Company < ApplicationRecord belongs_to :user has_many :garments end 2nd class Garment < ApplicationRecord belongs_to :company ,:class_name => "Superadmin::Company" end But when I search like company = Superadmin::Company.find(9) company.garments Its give error: as Garment Load (1.3ms) SELECT `garments`.* FROM `garments` WHERE `garments`.`company_id` = 9 ORDER BY created_at asc ActiveRecord::StatementInvalid: Mysql2::Error: Unknown column 'garments

Show action in partial won't display in index view - rails

青春壹個敷衍的年華 提交于 2019-12-25 00:16:41
问题 I have my show action within a partial called properties/_property_details.html.erb that I'm trying to display with ajax within the index action's view. properties/index.html.erb: <div id="showdiv"> <%= render :partial => 'property_details' %> </div> properties/_property_details.html.erb: <div id="response"> <h3> <%= [@property.Address,@property.City,"FL"].join(", ") %> <%= @property.Zip %></h3> etc etc </div> However, when I try to load the index page the @property variable of the show

Where is the right place to put predefined class (e.g. String, Symbol) extensions in Ruby on Rails?

青春壹個敷衍的年華 提交于 2019-12-24 23:31:08
问题 I would like to add my_method to the Symbol class, and be able to call my_method from app/helpers/application_helper.rb : module ApplicationHelper def my_helper my_symbol.my_method end end Where is the most appropriate place to put: class Symbol def my_method <some code here> end end ? 回答1: I think that sticking your native class extensions in a new file in your lib folder and require -ing them in your environment.rb file should do it. 回答2: I typically create a file named monkey_patches.rb

Rails Sign_in(user) not working - remember_token

▼魔方 西西 提交于 2019-12-24 23:01:15
问题 I'm trying to allow my users to sign in and I have narrowed my problem to one method. in session_helper.rb def sign_in(user) remember_token = User.new_remember_token cookies.permanent[:remember_token] = remember_token user.update_attribute(:remember_token, User.encrypt(remember_token)) self.current_user = user end def signed_in? !current_user.nil? end How do I check what my current column structure is in my database and make fix this issue? If a user signs in, it gives a positive flash

Rails 3 google maps

谁都会走 提交于 2019-12-24 22:47:54
问题 I'm trying to create a sample project with gmaps4rails gem: But getting an error: undefined method `gmaps’ for # Rails.root: /var/www/brandbk Application Trace | Framework Trace | Full Trace app/controllers/locations_controller.rb:46:in `block in create’ app/controllers/locations_controller.rb:45:in `create’ Request Parameters: {“utf8″=>”вњ“”, “authenticity_token”=>”CSpi+VhUe8CtF+4R6zxMEXbB8ofa0QxUF1ntGl+N1Ss=”, “location”=>{“address”=>”rwr”}, “commit”=>”Create Location”} Like this: http:/

form drop down select relationship

安稳与你 提交于 2019-12-24 22:25:34
问题 I am confused with this. I have a company model and a message model. Company has_many messages and messages belongs_to company. I am having problems with the data being saved to the proper company with this form is saved. <%= form_for(@msg) do |f| %> <%= render 'errors', :object => f.object %> <ul class="fields"> <li> <%= select("msg", "company_id", Company.all.collect {|p| [ p.title, p.id ] }) %> </li> </ul> <ul class="fields"> <li><%= f.label :content, "Send this company your message" %><