11
votes
1answer
2k views
Rails console 'y' helper returns NameError rather than yaml-formatting output
I'm trying to use y object in Rails 3.2.6/Ruby 1.9.3 console to get nicely formatted yaml output for an ActiveRecord object, but for some reason it isn't working for me. I've used it in the past, but ...
0
votes
1answer
48 views
CSV read v/s Temp table read from database, optimization of the loop and active record usage . Ruby
CSV parsing of the file was very slow so I was trying to load the file directly in to some temp table in database directly and then doing the computation as below :
Earlier it was like this, took 13 ...
80
votes
2answers
12k views
Use rvmrc or ruby-version file to set a project gemset with RVM?
I use RVM, the Ruby Version Manager to specify a Ruby version and a set of gems for each of my Rails projects.
I have a .rvmrc file to automatically select a Ruby version and gemset whenever I cd ...
9
votes
2answers
3k views
rake assets:precompile attempting to connect to database
I'm attempting to debug why my application is attempting to connect to my database when I run rake assets:precompile --trace.
I'm probably missing something in the stack trace...anyone see the ...
5
votes
2answers
2k views
SimpleCov reports not generating in Rails 3 app after running RSpec tests with Spork
I just installed the SimpleCov gem to generate code coverage reports on my Rails 3.2.6 app, and it works great with RSpec, just not with Spork. I am able to get the desired correct report by running ...
2
votes
3answers
126 views
undefined method `email' for nil:NilClass in Exibe the mail of table Father
I have a problem, i make this atribbuition i comment model:
class Comment < ActiveRecord::Base
attr_accessible :comment
belongs_to :post
belongs_to :user
and this in user model
class User ...
1
vote
0answers
74 views
failed to allocate memory on the console and internal server error on the browser
I have this error while loading the data from files in to database. Please help me out in getting this right.
here is the method :
clusters.each do |cluster|
cluster_path = cluster.path
...
1
vote
2answers
440 views
How to put a login form in the header for Devise and Rails
I want to put a login form in the header of my website. I use Rails 3.2.8 and the latest Devise. In the app/views/devise/sessions/new.html.erb file a login form is created with:
<%= ...
0
votes
2answers
197 views
error in foreman start for heroku during deploying rails application
I try to getting start with Rails 3.2.6 and Heroku. My Ruby version is 1.9.3 and my database.yml is like this:
development:
adapter: postgresql
encoding: utf8
reconnect: false
database: ...
0
votes
1answer
2k views
Mongoid Group By or MongoDb group by in rails
I have a mongo table that has statistical data like the following....
course_id
status which is a string, played or completed
and timestamp information using Mongoid's Timestamping feature
so my ...
-1
votes
1answer
75 views
!! Unexpected error while processing request: failed to allocate memory
Please help me in solving this error.
I am getting this error while loading records from text files in to database using ruby scripts.
It just works fine if I use small number of records to load ...
19
votes
4answers
3k views
Ruby on Rails plural (controller) and singular (model) convention - explanation
As per Ruby on Rails convention, controller names get pluralized while model names are singular. Example : a Users controller, but a User model.
rails generate controller Users
rails generate model ...
1
vote
2answers
2k views
how to do render partial on jquery ajax success method with rails 3
I'm using rails 3.2.1 with jquery for an ajax call.
My juqery code is :
jQuery.ajax({
url: "/org_pages",
data: 'org_id='+ org_id,
type: "POST",
...
20
votes
2answers
8k views
Rails 3.2, RSpec, Factory Girl : NameError: uninitialized constant Factory
Ive been following this introductory to Rails testing and Ive run into an issue I cant seem to find the solution to. Im very familiar with Rails but this is my first foray into testing.
Anyhow, I ...
6
votes
2answers
340 views
Is there a best practices/coherent way to update a database field that contains a hash key-value store?
I'm referring to Rails 3.2's Data Store feature, in which there's the option to store key-value stores in a textfield, even if you're using a relational database like MySQL...it works fine when ...