Questions tagged [ruby-on-rails-3]

4

votes
0

answer
37

Views

Rails (3.2) asset pipeline - is it possible to have condition by the current pipeline entry point?

I have multiple asset pipeline apps using common resources. I need these resources be tweaked according to which app required them, for example to have inlined asset or not accordingly. For example: application.rb: config.assets.precompile += %w( app1.js app1.css ) config.assets.precompile += %w(...
2

votes
0

answer
176

Views

rails and rake commands freeze/hang

I've recently updated an old application to from 3.2.13 to 4.2.10. I've got the application running in development mode but any rake or rails commands I try to run just hang/freeze. The terminal window will hang for a second and then nothing, I'm unable to even stop the process with ctrl-c. I've rea...
RobEW
4

votes
0

answer
157

Views

Odd behavior in Mongoid: after_add callback fired when accessing referenced model

The model's callback is being fired after accessing a referenced document. It is odd behavior and I am not sure why this happens. Here is a reproducible example: class Group include Mongoid::Document include Mongoid::Timestamps belongs_to :domain_group, :class_name => 'Domain', :inverse_of => :child...
mmss
2

votes
0

answer
202

Views

Rails 3.2.12/HTML 5 offline manifest

Where am I wrong ? I should have missed some important trick.... after compiling assets, and running my app in dev mode , going to root url ..**.I just get a white page .... Is it because I am running in dev mode on localhost ? the console : >> Listening on 0.0.0.0:3000, CTRL+C to stop Started GET '...
erwin
2

votes
0

answer
462

Views

Google-Maps-for-Rails blank map

I'm running Ruby 1.9, Rails 3.2.8 and gmaps4rails 1.5.5. I have followed the Readme, double checked I have in the footer and still I have a blank white box where the map should be with no errors. I have checked using Firebug and the Google JS, the gmaps4rails JS appearing to be loading and my contr...
Ryan
2

votes
0

answer
1.1k

Views

strong parameters with has_many through and accepts_nested_attributes_for

This is my Model class UnitPlate < ActiveRecord::Base has_many :unit_plate_components, :dependent => :destroy accepts_nested_attributes_for :unit_plate_components, :allow_destroy => true has_many :components, :through => :unit_plate_components end And this is the way i am writing the permitted_param...
AnkitG
3

votes
0

answer
179

Views

Running rake test on a Rails app that uses minitest only runs a single test. Is ruby deprecation a cause?

I'm currently trying to run tests in a Ruby on Rails app hosted with Puma instead of WeBrick. This is on Windows. Below is the error I get. C:\Users\Ka\Desktop\code\developmentdatabase>bundle exec rake test ansi: 'gem install win32console' to use color on Windows RubyDep: WARNING: Your Ruby is outda...
Ka Mok
3

votes
0

answer
112

Views

Sitemap.xml not working in Production

I am able to build the sitemap.xml in my dev environment, but on pushing it to production environment I keep getting this error. XML Parsing Error: mismatched tag. Expected: . Location: https://www.sample.com/sitemap.xml Line Number 68, Column 4: ---^ In controller I have it like this: def s...
sahil
2

votes
0

answer
514

Views

Ransack with options tag and populating select list [closed]

Im using Ransack pretty successfully at the moment with a regular old text_field for searches but i want an options tag with a select list of stuff that is in my database My first question is how to properly use a options tag to filter through my list.... My second question is how to fill up those...
user1502223
3

votes
0

answer
130

Views

Xlsx file gives error on MS Excel once it is zipped using rubyzip and unzipped on windows

Actually my requirement is to zip some files in some folders. I have already many files saved on my server and associated with some objects. So I have to zip all the files related to one object somewhat like this: Main Folder Sub Folder Another Folder XLSX File This is an example of my hierarchy. Wh...
Deep
2

votes
0

answer
483

Views

sunspot_rails Levenshtein distance operator

I'm using sunspot_rails (on rails3) to interface my rails app to a solr server. I would really like to perform fuzzy searches using the ~ operator. Anyway it seems that this is not supported. I'm now falling back to use EdgeNGrams but I'm not completely satisfied by the results. Any suggestion? Is a...
matteo
2

votes
0

answer
204

Views

Count in fields_for

I've a list of triplocations in a Trip which i would like to edit. The triplocations are associated with my Trip(Alot of locations in a trip). In my edit form I would like to number every location from 1 to * for the user to see. I know there's an option called each_with_index. But that doesn't appl...
CaptainCarl
4

votes
0

answer
471

Views

Overriding *_attributes= method rails with nested model

For some reason too long to explain I need to override the *_attributes=(attributes) method of my model, which accepts nested attributes for another model. As an example, here are my models: class Experience < ActiveRecord::Base accepts_nested_attributes_for :company def company_attributes=(attribut...
Renan
2

votes
0

answer
143

Views

How to save extra field values using has_may :through

I have these models class Product < ActiveRecord::Base # fields: name, weight, expiry_date, active... has_many :categorizations has_many :categories, :through => :categorizations end class Category < ActiveRecord::Base # fields: name, active... has_many :categorizations has_many :products, :through...
6

votes
0

answer
1.3k

Views

Add validation for custom fields in invitation form of devise_invitable

As I know, devise has validation only for email and password, which can be reconfigurated in initializer devise.rb: # ==> Configuration for :validatable # Range for password length. Default is 6..128. # config.password_length = 6..128 # Regex to use to validate the email address # config.email_regex...
Mike
2

votes
0

answer
126

Views

2 rails engines in 1 project, view problems

Currently i'm developing 2 Rails::Engines 1 blog (for fun) and 1 csv importer and mapper. I made them with enginex and jeweler into a gem. I installed them locally and i included either 1 of them in an empty rails 3.x project and it's working fine! The thing i want to do know is include both gems in...
1

votes
0

answer
702

Views

Restful-Authentication: “uninitialized constant User::Authentication” & “undefined method `key?' for nil:NilClass”

After trying to install the 'Restful-Authentication'-plugin on my Ruby on Rails site, I've been meeting some problems. I'm still new to Ruby on Rails, and programming in general, so I might probably have forgotten something, maybe. I'm running Ruby 1.9.3p125, and Rails 3.2.1 When browsing to the sig...
Kasper Nymand
3

votes
0

answer
259

Views

Rails 3.0.3: using vestal_versions with globalize3

I am trying to add vestal_versions (1.2.2) to a site that uses globalize3 (0.0.11) for localization of the Models. When I try to display the Version of a Model like this: t(:edit)), edit_page_path(@page) %> Version I get: TypeError in Viewer#show Showing /home/florian/spzwww3/app/views/viewer/show....
Florian
0

votes
0

answer
66

Views

rake db:create command is not working. Why? [duplicate]

Possible Duplicate: Library not loaded: libmysqlclient.16.dylib error when trying to run ‘rails server’ on OS X 10.6 with mysql2 gem I am new to Ruby on rails. I am running this command rake db:create but I am getting following errors. I do have installed mysql. Zafars-MacBook-Pro:erierb zafar...
2619
0

votes
0

answer
256

Views

OpenSSL::SSL::SSLError - read finished A: decryption failed or bad record mac

I am using RestClient to access an external API using a certificate available. I have useed it like this, require 'rest-client' p12 = OpenSSL::PKCS12.new(File.read('/root/cert.p12'), 'password') RestClient::Request.execute(method: :post, url: 'https://myurl.com', ssl_client_cert: p12.certificate, ss...
Balaji Ravichandran
3

votes
0

answer
117

Views

Rails3 incompatible character encodings: ASCII-8BIT and UTF-8 in html mailer template

I send a text e-mail alright, but the html version of the same generates a 'incompatible character encodings: ASCII-8BIT and UTF-8' error message, although both my controller and mailer have a '#encoding: utf-8' as a first line...
cedric
4

votes
0

answer
258

Views

Parse a local CSV with JavaScript or using Rails+JS

I have a Rails application that has some JavaScript that needs to parse CSVs and make some AJAX calls based on each record. I'd like to just load the local CSV directly into browser memory and have the JavaScript parse it and make the required AJAX calls but I haven't found a cross-browser, dependab...
Chris Cummings
5

votes
0

answer
439

Views

Rails Linkedin Omniauth OAuth::Problem, broke with no code change

I'm relatively new to RoR and recently built a working linkedin autorization. My linkedin OmniAuth connection appears to have broke. It was working perfectly fine for about 12 hours. However, my code base has not changed, but I am now getting the following error. OAuth::Problem parameter_absent Usi...
Josh_Katz
2

votes
0

answer
274

Views

How to add many child objects for a HABTM self-reference in Factory Girl Rails/Cucumber?

In the Project model: has_and_belongs_to_many :subprojects, :join_table => 'project_projects' In a Cucumber feature file: Given the following projects exist: | name | type | | first | foo | | second | bar | | third | baz | | fourth | bar | Given the following subprojects exist: | subproject...
l0b0
2

votes
0

answer
129

Views

Puma rails server not starting in Daemon mode on EC-2

I want to run Rails application on EC2 machine. When my SSH session terminates the rails server shutdown. I want to run the rails server in the background. I used rails s -d command to run rails daemon mode. But it seems like Puma is not started. This is the message I receive and after that process...
Kunal Budhiraja
2

votes
0

answer
84

Views

Custom log not being written to

Rails has deprecated log.auto_flushing in 3.2. Using file.sync is the recommended solution. I have a custom logger file set up by an initializer and subscribe to active support notifications that log to that logger. The notifications are triggered by the rails app & by rake tasks which are being run...
BM5k
3

votes
0

answer
308

Views

Creating children objects of not saved model in Backbone using Backbone-relational

I'm new to backbone. I have rails3 app. These are my backbone models: class AppName.Models.Order extends Backbone.RelationalModel paramRoot: 'order' relations: [ type: Backbone.HasMany key: 'order_services' relatedModel: 'AppName.Models.OrderService' collectionType: 'AppName.Collections.OrderService...
marat.adiyatullin
2

votes
0

answer
215

Views

I need help to sort out problems of asset pipeline with my app

I need help to sort out problems of asset pipeline with my app. Can anyone have look at what I am missing? Thanks in advance. I am using the following rails 3.2.13, ruby 1.9.3 (for development) and ruby 2.0.0 (for production on heroku). ( I am using a different version of ruby on production as a ge...
user3669547
3

votes
0

answer
493

Views

Execution order of multiple after_commit callbacks (Rails)

I recently found that multiple after_commits defined in the same model get called in reverse order. For example after_commit method1, :on => :create after_commit method2, :on => :create method2 gets called before method1. Is it always called in FILO order?
Sikai Zhu
1

votes
0

answer
52

Views

Rails services globally available

I have a rails API, I want to use the services globally without require them in the controllers. Print off the '#{config.root}' shows '/Users/sorry/Projects/project_Api/Api_test' Structure Api_test ----> app -----> services ------> services.rb In 'config/application.rb' I have tried many things...
Hedu
0

votes
0

answer
591

Views

habtm mongoid with counter_cache

A user can follow or join many groups and I need to sort groups by the most popular. To do this efficiently, I have created the following callback: before_save :update_followers_and_members def update_followers_and_members self.follower_count = self.followers.size self.member_count = self.members.si...
bonhoffer
0

votes
0

answer
31

Views

How does RVM pick where to find the gem

I noticed that rvm has more than one directory for saving 2.3.0 gems. /usr/share/rvm/gems/ruby-2.3.0/gems /usr/share/rvm/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems I want to understand how RVM decides which directory to use. I have this gem rspec_junit_formatter that does not work with bundler ne...
Jose Villalta
0

votes
0

answer
389

Views

can't find method in application controller

I've been trying to get authentication working with devise, and then omniauth, but I haven't been able to get the user session. In my application controller, I have class ApplicationController < ActionController::Base protect_from_forgery private def current_user @current_user ||= User.find(session...
pedalpete
2

votes
0

answer
28

Views

Rails: how can i customize the devise such that it produces user information after logging in

I have devise for authentication system. When i use curl -H 'Content-Type: application/json' -H 'Accept: application/json' -X POST http://localhost:3000/users/sign_in -d '{'user' : { 'email' : '[email protected]', 'password' : 'xxxxxxx'}}' This gives me {'user':{'authentication_token':'yyyyy...
logesh
1

votes
0

answer
451

Views

Running Stored procedure giving error can't return a result set in the given context

I know this problem has been asked many times. But I tried the solutions and they didn't work for me. I have a web application built on rails 3.2.12 and ruby 1.9.2p180. I have a stored procedure in it which returns me data of a query having 5 inner joins. Multiple rows approximately 600 are returned...
Deep
1

votes
0

answer
26

Views

migration from rails 3.1 to 3.2 with plugins and fix the deprecation warnings

I am working in a project with Ruby version 1.9.3 and Rails Version 3.1.12. Planning to Migrate the rails Version to 3.2.The issue encountered is with plugins; we have 6 plugins namely, autocomplete filter has_details in_place_editing restful-authentication role_requirement I was able to upgrade t...
Anoob K Bava
0

votes
0

answer
167

Views

Rails with Devise user confirmation link not confirming accounts

This hasn't been a problem in the past, but for some reason when I click the link in Devise confirmation emails for my Rails app, it goes to the site but doesn't confirm the account. My app is hosted on Heroku and I'm sending the emails through Mandrill. I just switched my app to HTTPS yesterday, s...
Tom Maxwell
1

votes
0

answer
281

Views

Failure/Error: click_link post.title ArgumentError: wrong number of arguments (1 for 0) Rspec & Capybara

require 'spec_helper' describe 'Posts pages' do let!(:posts) { FactoryGirl.create_list(:post, 3) } subject { page } describe 'Blog page' do context 'Listing all posts' do before do visit '/blog' end it 'should list all available posts' do posts.each do |post| page.should have_selector 'h3 a', :text...
hyperrjas
1

votes
0

answer
297

Views

RoR - Devise Mailer - gmail refusing to send message

Currently I am working on Cloud9 and trying to create a rails app where the Devise mailer can send the reset password function and other built in mailing features. What I think is happening, is that gmail is refusing to send the message because of the account. I even went on gmail and found the clo...
Joe Shmoe
2

votes
0

answer
155

Views

how can i verify data is streaming from a rails 3 template handler?

I've forked csv_builder to support a @streaming parameter. When streaming, the template handler uses a block like this: Enumerator.new do |output| output.write('writing some data') end I've verified that templates render properly, in terms of the content being correct, but I want to verify that dat...
fawce