Displaying 20 results from an estimated 48 matches for "cattr_accessor".
Did you mean:
attr_accessor
2013 Apr 08
1
cattr_accessor and Thread.current prblems
Hello,
I am trying to convert three applications to multitenant, all of them have
same structure difference is only in little functions and template designs.
All of them using cattr_accessor for setting currencies and other data, and
it works perfectly
Now i added app_id as cattr_accessor to App model to use it in
default_scope to implement multi-tenancy
class App < ActiveRecord::Base
attr_accessible :active, :name
cattr_accessor :app_id, :app_name
end
on development mode n...
2011 Sep 20
0
What's the difference between mattr_accessor and cattr_accessor in ActiveSupport?
Hi,
I was reading source code of mattr_accessor and cattr_accessor in
ActiveSupport and found out that the method definitions are all most
identical. Except cattr_writer accepts a optional block.
I googled and read
http://stackoverflow.com/questions/2203800/difference-between-mattr-accessor-and-cattr-accessor-in-activesupport.
That guy had the same question as me...
2006 Nov 24
13
rSpec on Rails 1.2?
I just updated my Rails install to the most current Edge and my
controller specs fail:
1)
TypeError in ''The User Controller should be a user controller''
can''t convert nil into String
Each spec fails the same way.
<context string> <spec string>
can''t convert nil into String
Any ideas what''s up with this?
Thanks,
s.ross
2006 Mar 29
0
cattr_accessor missing for test of AR
Hello.
I''m trying to test an active record adapter. When launching :
ruby -I "connections\native_adaptername" anytest_test.rb
I have an method missing error, complaining about cattr_accessor
(missing from AR:Base).
Any advice ?
Tony
PS : ruby 1.9, rails 1.10 install via gems
--
Posted via http://www.ruby-forum.com/.
2006 Sep 05
5
cattr_accessor
Hi,
i''ve been playing with ror for a little over two months now, and was
wondering wether someone could explain to me what was
cattr_accessor
and if it is still in use. . . i looked up in api.rubyonrails.com and
coulnd''t find any documentation...
is it a useful/worth learning method? what do u use it for?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this messag...
2006 Jan 05
0
cattr_accessor
Is this specific to rails? What''s it used for and when is it approriate
to us it?
Is there also a mattr_accessor?
--
Posted via http://www.ruby-forum.com/.
2008 Dec 31
1
when to set a class attribute variable during boot
I have an ActiveRecord model with a cattr_accessor. The class
attribute is set up like this:
class MyModel < ActiveRecord::Base
cattr_accessor :my_attribute
end
Because I need to give #my_attribute environment-specific values, I
try to set this attribute in environments/development.rb like so:
MyModel.my_attribute = 3
But this leads to odd...
2006 Feb 02
4
rails-1.0.0 gem rdoc problem
...not generated rdoc for gem_server.
Looking into the problem, it seems that there is an error when doing ''rake rdoc''
for rails-1.0.0.
% rake rdoc
(in /opt/local/ruby-1.8.4/lib/ruby/gems/1.8/gems/rails-1.0.0)
rm -r doc
unrecognized option `--line-numbers --inline-source --accessor
cattr_accessor=object''
For help on options, try ''rdoc --help''
rake aborted!
exit
(See full trace by running task with --trace)
This can be fixed with the following change:
--- Rakefile 2006-02-01 18:24:07.000000000 -0600
+++ Rakefile.bak 2006-02-01 18:25:38.000000000 -060...
2006 Apr 06
7
LoginSystem : make @session available to models
Hello.
LoginSystem is cool, it populates the @session instance variable of
controllers with many useful info.
The fact is : it would be cool to let models know about the session,
too.
For instance, after_update and after_create callbacks could store *who*
did *what* on *what.
Aim : having ActiveRecord::Base::session defined, returning the @session
of the controller which manipulates the
2008 Sep 06
6
Configuring custom library
Hi,
I''ve added a custom library called lib\AccountSystem like so:
"module AccountSystem
SINGLE = 1
MULTIPLE = 2
class << self
attr_accessor :account_system_type
end
end"
Now I wanna configure
AccountSystem.account_system_type=AccountSystem::SINGLE in one app. I
used an initializer: config/initializers/account_initialization.rb
where I put this line in.
I
2010 Oct 01
8
field_with_errors.
If a model doesn''t pass validation the field in the view is put under
a <div class="field_with_errors">.
But who create that div? field_text helper do it?
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
2006 Jun 23
0
help... can''t run ActiveRecord unit tests to test bug fix
...run the AR tests. I followed the instructions in
RUNNING_UNIT_TESTS but it generates an error immediately
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/test cremes$
ruby -I "connections/native_mysql" active_schema_mysql.rb
./../lib/active_record/base.rb:246: undefined method `cattr_accessor''
for ActiveRecord::Base:Class (NoMethodError)
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:21:in `require''
from ./../lib/active_record.rb:37
from ./abstract_unit.rb:5
from active_schema_mysql.rb:1
It can''t seem...
2008 Nov 19
3
Mock today
In some of my unit tests, I find the need to set today to a different
value than the actual today. For example, to test the model method
"balance_of_today", which takes no argument, I want to have Date.today
be a specific date for the purpose of testing. In other words, I want
to do something like this:
mock_today(Date.new(2008, 2, 1)) do
... test code...
end
My implementation for
2005 Oct 03
3
Boolean quoting, postgresql
...s on. Now it''s probably a few lines to fix our unit tests, but
we may be breaking other peoples applications.
What are people''s thoughts on this? I personally like the patch,
naturally, and I figure the change is easy enough for people to
implement.
We could always create a cattr_accessor which lets people turn this
off, but that''s a lot of software...
--
Cheers
Koz
2007 Mar 05
1
ODBC Adapter woes
...a native DB is used?
2. Also, how do I configure the database.yml to use the new ODBC driver?
Any help is greatly appreciated.
Error output below:
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/connection_adapters/abstract/connection_specificati
on.rb:14: undefined method `cattr_accessor'' for ActiveRecord::Base:Class
(NoMethodError)
from
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require''
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/connection_adapters/abstract_adapter.r
b:10
from
c:/ruby/l...
2006 Mar 25
7
Overriding <div class="fieldWithErrors">
Does anyone know how to override the <div class="fieldWithErrors">
behaviour when a form field is incorrect?
Thanks,
Dan
2006 Jun 07
1
Using DRb within Rails
I want to use DRb within my Rails app. Right now I''ve got a very basic class:
class PaymentGateway
cattr_accessor :ssl_config, :host, :port
def self.gateway
@@gateway ||= new
end
def process(amount, card, type = :auth)
@biller.process(amount, card, type)
end
def set_card(user_id, number)
@biller.set_card(user_id, number)
end
protected
def initialize
DRb.start_service nil, ni...
2006 Jul 27
2
Creating multiple objects from form data
I''m in the process of creating a sign up form for an online application.
The form collects account info, company info, and then info for an
administrative user.
The method looks like this:
def create
@account = Account.create!(params[:account])
@company = @account.companies.create!(params[:company])
@user = @company.users.create!(params[:user])
end
However, this inevitably fails
2006 Sep 04
2
"include" versus "extend" - what's the difference
...on''t allow multiple calls
return if
self.included_modules.include?(CollectiveIdea::Acts::Audited::InstanceMethods)
include CollectiveIdea::Acts::Audited::InstanceMethods
class_eval do
extend CollectiveIdea::Acts::Audited::SingletonMethods
cattr_accessor :non_audited_columns,
:audited_user_class_name, :audited_user_method
self.non_audited_columns = [self.primary_key,
inheritance_column, ''lock_version'', ''created_at'', ''updated_at'']
self.non_audited_columns |= options[:except...
2006 Jan 16
16
acts_as_authenticated current_user in a model?
What do I need to do to be able to use an acts_as_authenticated
current_user in a model?
Is there some sort of include or require I can do some where that would
allow this?
**********************************************************
Here is what I am trying to do:
**********************************************************
class Setting < ActiveRecord::Base
before_create :created_by_user #