Questions tagged [rails-console]

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.

441 questions
0
votes
1 answer

Rails: saving record from console with Timezone

I created a new object and saved the same through the console. I noticed that created_at and updated_at columns were in GMT format but when I do a Time.now in my console I get the time in my time zone. How can save my records from the console with…
Rahul
  • 44,892
  • 25
  • 73
  • 103
0
votes
1 answer

Rails 2.3.14 - to_datetime returns UTC time

I have a following issue - I'm not using config.time_zone, so it should default to my server time zone (if I understand it correctly). And in my rails console when I do something like 'Oct 12, 2012'.to_datetime it returns Fri, 12 Oct 2012…
Masha
  • 327
  • 1
  • 6
  • 17
0
votes
1 answer

Validation works in the browser but doesn't work in the console. Why?

I have the following custom validation: app/validators/clock_able_validator.rb class ClockAbleValidator < ActiveModel::Validator def validate(record) time_tracker = time_tracker(record) error_location =…
Marius Pop
  • 1,431
  • 2
  • 19
  • 32
0
votes
1 answer

how to use rails-console to manage multiple applications in Cloudfoundry

I have 2 applications hosted on Cloudfoundry. when i created the first application. i used vmc rails-console app1 to manage it and it worked perfectly. then i added the second application and try to connect to rails-console by vmc rails-console app2…
sufish
  • 3
  • 2
0
votes
1 answer

rails dbconsole drops me into my 'test' database

For some reason, when I run rails dbconsole command, it brings up my test database. I think that I must have some file misconfigured. I don't even know where to start looking to correct this. Its really annoying.
E.E.33
  • 2,013
  • 3
  • 22
  • 34
0
votes
1 answer

Cloudfoundry - Can not access database when using vmc rails-console

I have deployed a rails application (using rails 3.2.3. ruby 1.9.2), it's up and running and everything is working. Then I tried to manage it using rails console, as vmc rails-console myapp. The console can be connected but when I issue a command…
sufish
  • 3
  • 2
0
votes
1 answer

how to replace null by value of an attribute in rails console

I'm writing a redmine plugin where model is Allissue. I added two attributes project_name and create_date. First, I added column project_name and assigned them some values. Second, I added one more column created_date for which values become null as…
Dipendra Singh
  • 542
  • 1
  • 6
  • 23
0
votes
1 answer

Unitialized constant error in rails console vs. irb using a Mechanize wrapper

First question from a fundamental level - What is the meaning of an un-initialized constant error in Ruby? I come from an objective-c background, if that helps provide some context. Secondly, I am running a rake task in rails that is throwing the…
samfu_1
  • 1,160
  • 16
  • 30
0
votes
0 answers

Rails 3: Undefined method after adapting existing sqlite db

In rails console doing User.first and Post.first works fine. Post.first.user works fine but User.first.posts gives me an Undefined method error The models: class User < ActiveRecord::Base attr_accessible :role :user_email, :user_name …
Bjorn
  • 455
  • 4
  • 13
0
votes
3 answers

RSpec results and Rails Console behaving differently

Here is my Lesson model: before_create :set_sequence def set_sequence maxseq = Lesson.where(:course_id => self.course_id).maximum("sequence") if (maxseq.nil?) maxseq = 0 end self.sequence = maxseq + 1 end when I run rspec the following…
0
votes
1 answer

Ruby on Rails - how to invoke a ruby class from console?

I have this class: module App module Tools module Pollers class Kpi ... I am in the rails console and I am trying to do something like this: x = App::Tools::Pollers::Kpi.new The system does not give an error, but it doesn't do…
Genadinik
  • 18,153
  • 63
  • 185
  • 284
0
votes
1 answer

Difference between memory and database calls

Ok, my main problem on my first project was speed. I don't know which is which, between memory and database calls. I have two questions: How can I differentiate a database call from a memory call (if that's how its called)? I had encountered an…
-1
votes
2 answers

Rails Console requiring Factory Girl fails

I know that FactoryGirl has been deprecated in favor of FactoryBot, but we haven't yet updated our code, so we are still using FactoryGirl. Regardless, requiring FactoryGirl in the Rails Console should work, but it isnt'. The gem is included…
Asif
  • 748
  • 3
  • 9
  • 32
-1
votes
1 answer

How to print JSON object in browser console, using ruby controller?

I want to print a JSON object in the browser's console, I searched a lot but I din't find any appropriate result. Here is my ruby controller: class ScheduleTime < ApplicationController available_schedule = ScheduleTimeSlot.where(:doctor_id =>…
Vishal Nagda
  • 1,165
  • 15
  • 20