the interactive, command-line interface to the Ruby-based Rails framework. The Rails console allows developers to interact directly with their application without using a browser.
Questions tagged [rails-console]
441 questions
0
votes
0 answers
Getting a lot of extra error information ".../commands/console.rb:..."
I'm working on a ruby on rails tutorial and using the rails console
When an error occurs I'm seeing a lot more error information than the tutorial shows (could be that they ommited it for brevity)
For example:
2.1.1 :001 > asdf
NameError: undefined…

Drewdavid
- 3,071
- 7
- 29
- 53
0
votes
1 answer
Rails: Rspec and console output differ
I'm having an issue with my specs. I'm trying to run a spec that creates and destroys an associated object, but none of my specs are creating or destroying that object. The weird thing is, I can literally copy and paste every line of code (except…

user3181113
- 758
- 2
- 11
- 23
0
votes
1 answer
How can I run rails console from within ConEmu
I recently started using ConEmu and am developing with RoR. For the life of me I can't figure out how to run the rails console within ConEmu.
Directions anyone?

Gaege
- 815
- 2
- 9
- 24
0
votes
0 answers
Copy Pasting Code from Sublime Text onto console(rails)
When I try copy pasting code from my Sublime Text 3 editor onto the console, something goes wrong. I get the following message:
Display all 802 possibilities? (y or n)
While there is no problem when I copy paste the code from vim.
It seems some…

Karan Verma
- 1,721
- 1
- 15
- 24
0
votes
1 answer
Why do i need to reload this CollectionProxy in the rails console but not when testing?
I've been creating a cart feature in rails and I have the following models:
Cart:
class Cart < ActiveRecord::Base
has_many :items
end
Item:
class Item < ActiveRecord::Base
belongs_to :cart
belongs_to :product
end
An item also has a quantity…

cast01
- 663
- 8
- 23
0
votes
1 answer
Rails scope works different in spec and console
I have this class
class Invoice < ActiveRecord::Base
scope :last_with_number, -> (firm) {firm.invoices.where('number IS NOT NULL').order("number ASC").last}
end
When I run Invoice.last_with_number(Firm.first).number in the console, I get this…

Andreas Lyngstad
- 4,887
- 2
- 36
- 69
0
votes
1 answer
how to update permalink column is null using permalink_fu in rails console?
How to update column permalink null using permalink_fu in rails console?
Let say i have a table_name article,the column is title and permalink.
I want to update only the null permalink.

Marcelo Austria
- 861
- 8
- 16
0
votes
2 answers
simple method in User model - trying to call it in console
Ok, simplistic question.
There's this method in User model:
def name_email
"#{first_name} #{last_name} - #{email}"
end
All right, by the virtue of the fact that it doesn't have self attached to the method, one can deduct that it's an instance…

user273072545345
- 1,536
- 2
- 27
- 57
0
votes
4 answers
Rails console outputs dirty/outdated data
I'm following Michael's Ruby on Rails tutorial (Chapter 6.2.2) and when I go to the rails console --sandbox to attempt to create Users the outputs come totally outdated.
I update a user's attribute, I return the user and the console outputs nil for…

dialex
- 2,706
- 8
- 44
- 74
0
votes
1 answer
Debugging in rails Console
I have this script that i would like to test within the rails console
Gem.find_files("models/*.rb").each do |f|
filename = File.basename(f, '.*')
class_name_symbol = filename.classify.to_sym
autoload class_name_symbol,…

Richlewis
- 15,070
- 37
- 122
- 283
0
votes
1 answer
Access private methods in the rails console
I'm experimenting with n+1 queries in the rails console, but running
> Zombie.include(:brain).all.each do |z| z.brain end
Results in this error:
NoMethodError: private method `include' called for #
Is there anway I can…

Starkers
- 10,273
- 21
- 95
- 158
0
votes
1 answer
Rails object deleted in development, but apparently not in production. Why?
I have a bunch of College objects. I print them all out here: http://www.collegeanswerz.com/colleges. (excluding the alphabetical tab. for that I hand coded the HTML)
Take the Rank tab as an example. (The Size and Table tabs are analogous to this…

Adam Zerner
- 17,797
- 15
- 90
- 156
0
votes
2 answers
Rails console search path and Postgres
I need to add a new user to my app's Postgres User table located in the test schema. When I access the console, rails automatically sets the search path to "$user",public and the new user record is saved to the public schema, not the test schema. Is…

Anconia
- 3,888
- 6
- 36
- 65
0
votes
1 answer
How can I dump class definition to file from rails console
Say I've been hacking away at something in Rails console and in the process I've created some classes and methods I'd like to keep. Is there a way to get this code somehow, and dump it to a file or something so I don't need to type it all again…

zako42
- 634
- 9
- 16
0
votes
0 answers
Rails console returning binary field
I have a binary field called extra_data. When I output this field within the pry-console in development, I get:
t.extra_data
=> "\x00\x00\x00\x04\x00\x00\x00\vdescription\x00\x00\x000Child Sponsorship Fund: Haiti: Cyvadier: …

Packersville
- 73
- 2
- 8