Displaying 20 results from an estimated 50000 matches similar to: "Re: undefined method `count' for Array..."
2009 Dec 23
0
Re: undefined method `count' for Array...
Ryan Bigg wrote:
> Try User.count or User.all.size.
Unless I missed it it seems that no one actually mentioned the real
difference between these two calls. While they will produce the same end
result the process of getting to that result is very different:
n = User.all.size
=> 123
SELECT * FROM "users"
n = User.count
=> 123
SELECT count(*) AS count_all FROM
2010 Nov 09
2
Undefined method
I am very new to ROR. (Ruby 1.8.7, rails 2.1.1, rack
0.8.7, mysql 5.1.41)
I has my_app/lib/migration_helpers.rb file:
module MigrationHelpers
def self.foreign_key(from_table, from_column, to_table)
constraint_name = "fk_#{from_table}_#{to_table}"
execute %{alter table #{from_table}
add constraint #{constraint_name}
foreign key (#{from_column})
2010 Feb 23
1
undefined method `scaffold' for AdminController:Class
Hello everyone! I think a little background is necessary.
I''ve been a web-developer and linux user for a little over 4 years now,
primarily working with PHP and MySQL. I''ve tried several other
frameworks like Django and CodeIgniter and several other languages,
including python, perl, ASP/.NET, javascript and javascript frameworks,
also worked with Oracle and PostgreSQL and many
2011 Jan 13
5
undefined method `xss_terminate'
I''m trying to run a rails app developed by my firm on my Ubuntu machine.
I''m using RVM with what I think are all the appropriate gems installed.
The application works fine on co-workers OSX machines.
When running db:migrate I get the following error:
$ rake db:migrate --trace
...
rake aborted!
An error has occurred, all later migrations canceled:
undefined method
2012 Jun 06
1
why to get the error 'undefined method `write_inheritable_attribute''
I started getting this error message when I attempt to do some rake
tasks:
$ rails destroy scaffold genotypes
/usr/share/rails-ruby1.8/railties/lib/rails_generator/options.rb:32:in
`default_options'': undefined method `write_inheritable_attribute'' for
Rails::Generator::Base:Class (NoMethodError)
from
/usr/share/rails-ruby1.8/railties/lib/rails_generator/base.rb:90:in
2012 Sep 18
2
undefined method `to_sym' for nil:NilClass
Hi all,
I am trying to upgrade my rails 2 app to 3 and am getting this error
when trying to login:
NoMethodError in AuthenticateController#authenticate
undefined method `to_sym'' for nil:NilClass
The stack trace is:
activerecord (3.2.2) lib/active_record/validations/uniqueness.rb:26:in
`validate_each''
activemodel (3.2.2) lib/active_model/validator.rb:153:in
2011 Nov 19
3
undefined method `+@'
Any idea what might be wrong?
ActionView::Template::Error (undefined method `+@'' for
#<ActionView::OutputBuffer:0x00000002e51580>):
--
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 group, send email to
2011 May 27
4
undefined method `model_name' for NilClass:Class in a form_for
Hi! I know that there are other topics about this issue, I read them and
I''m always blocked. Here is the error message:
undefined method `model_name'' for NilClass:Class
Extracted source (around line #30):
27:
28: <h2>Add Translation</h2>
29:
30: <%= form_for @new_trad do |f| %>
31: Locale: <%= f.text_field :locale %>
32: Key : <%=
2011 Dec 03
2
script/server error (undefined method `name' for "ZenTest")
Hi All,
I have an rails 2.3.11 app which I''m trying to run locally. When runnign
script/server i get this error which i googled but couldn''t find the
answer anywhere:
Gem::SourceIndex#initialize called from
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/rails/vendor_gem_source_index.rb:100.
Invalid gemspec in
2010 Mar 09
3
undefined method join for STRING error
Hey all,
I was converting a haml file to erb and when finished, I ran the app
and got this error message:
NoMethodError in Students#student_fail
Showing app/views/students/student_fail.erb where line #40 raised:
undefined method `join'' for #<String:0x105a5e0c8>
Extracted source (around line #40):
37:
38: <% fields << render(:partial =>
2012 Mar 10
4
undefined local variable or method 'game'
I am doing a web shop assignment and have got a problem with my action
mailer.
I get an error undefined local variable or method ''game''
I have the following in my mailer:
def game_interest(user, game)
@user = user
@game = Game
mail :to => user.email, :subject => "Game Interest"
end
and the following in my controller:
def email
@game =
2009 Dec 29
1
undefined method `alias_method_chain' for I18n::Backend::Simple:Class
Hi,
We are running RE:
ruby 1.8.7 (2009-06-12 patchlevel 174) [sparc-solaris2.10], MBARI
0x8770, Ruby Enterprise Edition 2009.10
I tried a simple web app with a controller rendering a text and is
working in my PC but on the server I get:
Error message:
undefined method `alias_method_chain'' for
I18n::Backend::Simple:Class
Exception class:
NoMethodError
Application root:
2010 Dec 01
1
Prawn : undefined method `make_table'
require ''prawn''
require ''prawn/core''
require ''prawn/layout''
Prawn::Document.new do |pdf|
subtable = pdf.make_table([[ "foo", "bar" ], [ "baz", "bax" ]],
:column_widths => [ 50, 50 ]) {
column(0).background_color = "808080"
cells.borders = []
2011 Sep 26
2
undefined method `options' for #<EventMachine::HttpClien
Hi , I am writing a rake task to consume twitter stream API. The task
contains the following code:
consumer = OAuth::Consumer.new(CONSUMER_KEY, CONSUMER_SECRET, :site =>
''http://twitter.com'')
access_token =
OAuth::AccessToken.new(consumer,ACCESS_TOKEN,ACCESS_TOKEN_SECRET)
oauth_params = {:consumer => consumer, :token => access_token}
EventMachine.run do
# now,
2013 Jun 29
0
rake db:create giving undefined method `' for nil:NilClass
My ruby version is 1.8.7
I have installed mysql-essential-5.0.90-win32
and using Fedena 2.3.5
List of all gems installed:*
columnize (0.3.6)
declarative_authorization (0.5.1)
fattr (2.2.1)
ffi (1.9.0)
gem_plugin (0.2.3)
highline (1.6.19)
i18n (0.4.2)
metaclass (0.0.1)
mime-types (1.23)
mocha (0.14.0)
mongrel (1.1.5)
mysql (2.8.1)
net-ping (1.6.0)
prawn (0.6.3)
prawn-core (0.6.3)
prawn-format
2012 May 14
1
undefined method `parse' for String:Class
Hi,
I use a script called : add_admin.rake
When i execute this : ''rake -s -f Rakefile mailserv:add_admin --trace
i have this error :
** Invoke mailserv:add_admin (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute mailserv:add_admin
rake aborted!
undefined method `parse'' for String:Class
2010 Sep 23
1
undefined method `protect_against_forgery?' for #<ActionView
Hi guys
This is a pretty tricky one.
I get a "undefined method `protect_against_forgery?'' for
#<ActionView::Base:0x569a3d4>" error when trying to generate a partial
from ''outside'' the web site. I do this as I have a rake task that checks
for changes periodically in the background, and if it then sees a change
it rebuilds the partial and posts the result
2012 Jul 18
3
Undefined method error
I have been working on a project based on Michael Hartl''s book Ruby on
Rails Tutorial in order to try to teach myself Ruby on Rails. However,
when it tries to render a form designed to allow a user to submit a
small message, I get an error saying, "undefined method `model_name'' for
NilClass:Class". It says the error is at line 1, which is "<%= form_for
2012 Aug 16
6
undefined method `with_indifferent_access' for "":String
Hi
I''m having a issue with one object when try to update the attributes in
this object previously saved in the database
I have one object comp and one object reg they have this relationship
comp
has_many regs
reg
belongs_to comp
when run use the method valid? like this
current_contribuyente.comps.build(params[:comp]).valid?
it returns: IndexError (string not matched)
And when
2012 Oct 17
6
NoMethodError (undefined method `service_options' for nil:NilClass)
hi i am using rails 2.3.4 and i am facing "no method error"
there is possibility to not find method but my question is - is there
possibility to error occurred because of empty table? or error in another
controller or helper?
error trace:
Processing QuoteRequestsController#create (for 127.0.0.1 at 2012-10-17
16:07:34) [POST]
Parameters: