Displaying 20 results from an estimated 300 matches similar to: "Mocking/Stubbing ActiveRecord.config.default_timezone"
2006 Nov 10
3
Stubbing Time.now in trunk
I''m a big fan of stubbing Time.now so it returns a known value. I used
to be able to use stubba and say:
@time_now = Time.parse("Jan 1 2001")
Time.stubs(:now).returns(lambda{@time_now})
However, something in trunk broke that. Fine, rspec''s got its own
stubbing lib now, so I tried switching to that:
@time_now = Time.parse("Jan 1 2001")
2010 Jan 21
2
nested forms and attr_accessable
Rails 2.3.5
I am working on a nested form that assigns roles to users through a
table called clearances. I have attr_acessable turned off globally in
an initializer:
ActiveRecord::Base.send(:attr_accessible, nil)
I have this set in clearance.rb
attr_accessible(:description,
:effective_from,
:role_id,
:superceded_after,
:user_id)
And this is what params looks like after the
2009 Feb 10
1
config.default_timezone vs. config.time_zone
In config/environment.rb are these statements equivalent?
config.default_timezone = :utc
config.time_zone = "UTC"
If not, then how do they differ in effect?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this
2006 Aug 31
0
time_zone_select Acting Funky
I am using time_zone_select for the first time:
<%= time_zone_select(''user'', ''default_timezone'') %>
I have an instance variable called user and that model has an attribute
called ''default_timezone''.
The list displays and when I submit the form, I see it sends the data:
Parameters:
2006 Sep 01
0
time_zone_select Doesn't Update in Save
I am using time_zone_select for the first time:
<%= form.time_zone_select(''default_timezone'') %>
I have an instance variable called user and that model has an attribute
called ''default_timezone''. This is all inside a nice form_form construct.
The list of time zones displays and when I submit the form, I see it sends
the data:
Parameters:
2019 Oct 03
2
[PATCH] Avoiding Dereferencing of NULL pointer
Signed-off-by: krishnaiah bommu <krishnaiah.bommu at intel.com>
---
moduli.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/moduli.c b/moduli.c
index 578fc48..c1fa484 100644
--- a/moduli.c
+++ b/moduli.c
@@ -153,12 +153,14 @@ static int
qfileout(FILE * ofile, u_int32_t otype, u_int32_t otests, u_int32_t otries,
u_int32_t osize, u_int32_t ogenerator, BIGNUM *
2009 Feb 09
3
RSpec Testing ActiveRecord config dependency.
I have the following library code:
def normal_time_now
return DateTime.now.utc if default_timezone == :utc
return DateTime.now
end
This is dependent upon a setting in config/environment.rb
# Make Active Record use UTC-base instead of local time
config.active_record.default_timezone = :utc
I want to test that I get the expected results with the config set to
utc and
2009 Jan 19
0
How to add SipAddHeader in outgoing call file.
How to add SipAddHeader in outgoing call file.
I am implementing a Callback scenario, in which a user makes a call to
Local Access Number. The system have to callback to the user. During
callback a call file is generated. All I want, is to add
SipAddHeader("pchargingvector","val") in outgoing Invite.
How can I achieve this?
Please help me, where can I add SipAddHeader() in
2008 Mar 08
9
Validation error handling on related models
I have 2 models, entity and client. Entity has_one client and client
belongs_to entity.
Entity has attributes name and legal_name. Entity also has an unique
index on (lower(name)). The pKey for both is the conventional Rails id.
Client has a fKey constraint on entity_id and is indexed in entity_id.
In controllers/clients_controller.rb I have:
# GET /clients/new
# GET /clients/new.xml
2009 Jan 16
2
want to add SipAddHeader in call out file
How to add SipAddHeader in outgoing call file.
I am implementing a Callback scenario, in which a user makes a call to
Local Access Number. The system have to callback to the user. During
callback a call file is generated. All I want, is to add
SipAddHeader("pchargingvector","val") in outgoing Invite.
How can I achieve this?
regards,
Asif
2006 Jun 23
0
Multiparameter error
Hello,
What''s the best way to deal with dates prior to 1970 using Rails. I''ve
seen some suggestions for hacks to fallback to the Date class if Time
fails, but I''m not sure exactly how to implement them.
This is from the wiki
require ''date''
# It''s necessary to do this, because Time doesn''t
# support dates before 1970...
class
2005 Apr 04
0
Rails timezone problems / DST
Last week I started to sketch out what would be involved in building a
calendar app in Rails. In the process I went looking for what Ruby
has in the way of Date/Time libraries, and in particular TimeZone
support. Was (pleasantly?) surprised to find that Rails seems to have
Ruby''s best timezone support. But it looks like it has a very serious
bug, it isn''t daylight saving
2009 Jul 28
1
Rails date conversion
The environment.rb file in a Rails 2.3.2 app says:
> Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
Auto-convert to this zone... when?
Also, what are the differences between these two statements?
config.time_zone = xxx
config.active_record.default_timezone = xxx
I ask these questions because I have a scenario whereby an AR-backed
object, when
2011 Jul 20
1
Time.zone is nil creating problems
Hello guys,
I am using ruby 1.9.2-p290 and rails 2.3.11 and when i am trying to
run Time.zone in my console it is showing me nil and when i am trying
to mention it in the environment.rb file by config.time_zone = ''UTC''
it is showing me an error
.rvm/gems/ruby-1.9.2-p290/gems/rails-2.3.11/lib/initializer.rb:561:in
`initialize_time_zone'': Value assigned to
2010 Jan 26
6
Subclassing ActiveRecord::Base
First of all, sorry for the crossposting, but I put this into the Ruby
Forum first of all, but was pointed to this as a more appropriate
location.
I''m using ActiveRecord and ActiveSupport in a non-rails environment
to connect to multiple databases, and I''ve found the following (single
database) to cause me an error. Note that params is my database settings
and omitted for
2006 Jun 07
4
Setting default timezone ENV[''TZ'']=''UTC'' not working on windows?
Hi,
I''ve been trying to do timezone conversion, and have some trouble
getting it to work on my Windows machine. Searching the web, I found
http://wiki.rubyonrails.com/rails/pages/HowtoSetDefaultTimeZone
...which explains how to set the default timezone. I''m using an
environment.rb that include the lines:
ActiveRecord::Base.default_timezone = :utc
ENV[''TZ''] =
2007 Apr 03
1
Some timezone trouble involving tzinfo and postgresql
Friends,
So there I was, minding my own business, trying to make my rails app
timezone aware (DST, as well), since it''s all about the timing with
this one. There are a number of excellent articles that I''ve been
working off of, in particular this one internet archived version of
Scott Barron''s very useful article on the subject that is no longer
available at the
2013 Feb 07
11
Rails change default time zone.
Hello everyone,
I am using rails 3.2.8.
I want to change time zone to New York time.
I changed following, but didn''t work
#config/application.rb
config.time_zone = ''Eastern Time (US & Canada)''
config.active_record.default_timezone = ''Eastern Time (US & Canada)''
If am wrong please clarify.
Thank You!
--
You received this message
2007 Jan 08
0
mocking/stubbing ferret
Does anyone have an experience with mocking/stubbing ferret, in order
to increase speed? I''ve taken a look at what it might entail and from
what I''ve seen it would have to be a pretty elaborate system. But I
am not very experienced with mocking/stubbing.
Any tips much appreciated.
John
2007 Mar 27
2
mocking/stubbing newbie questions
I''m new to mocking and stubbing. Can someone help me out with the
following? I don''t exactly know why this spec is failing:
describe "GET /users/1/terms" do
controller_name :terms
setup do
@user = mock_model(User)
User.stub!(:find).and_return(@user)
end
def do_get
get :index, :user_id => 1
end
it "should find all terms