Displaying 20 results from an estimated 1000 matches similar to: "Nil.to_sym Problem"
2008 Oct 25
2
Update action | NoMethodError | nil.to_sym
Ok, totally no reason why I''m getting an error in this model update
and no other. HELP!
CONTROLLER:
# GET /employees/1/edit
def edit
@employee = Employees.find(params[:id])
end
VIEW:
<h1>Edit Employee</h1>
<div id="main-sub">
<%= error_messages_for :employees %>
<% form_for(@employee) do |f| %>
<table width="600"
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
2010 Jun 07
1
undefined method 'to_sym' for ["<var>", "<var">]:Array
I am running into a problem with my LDAP puppet setup with this error
message:
PuppetClient:
err: Could not retrieve catalog from remote server: Error 400 on SERVER:
Could not parse for environment DR: undefined method `to_sym'' for ["ENV1",
"ENV2"]:Array
PuppetMaster:
err: Could not parse for environment DR: undefined method `to_sym'' for
["ENV1",
2006 Dec 20
0
undefined method `to_sym' for #<YAML::Syck::MergeKey...
I have a stock gentoo rails install. I get something like this when I
try to use script/generate, rake migrate or script/console and probably
others.
0 wicked www/sharkwatch % ./script/console
Loading development environment.
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/core_ext/hash/keys.rb:27:in
`symbolize_keys'':NoMethodError: undefined method `to_sym''
2011 Jul 11
2
Can't get this Rspec test to pass
Hello,
I''m completely new to Rspec testing and I''m finding it very difficult to
mock specific objects.
In this test, I have a before block setup as such:
[code]
before do
setup_controller_for_warden
controller.session[:operation_id] = 1
@operator = Factory :operator
sign_in :operator, @operator
@persist_herd = Herd.new
2007 Jun 19
3
Nil object for nested resource
Hi all,
I have 2 models with a standard 1 to many relationship. I''m also using
REST on the two models and have added the appropriate code to the
routes.rb file.
scorecard.rb:
class Scorecard < ActiveRecord::Base
has_many :attributes
end
attribute.rb:
class Attribute < ActiveRecord::Base
belongs_to :scorecard
end
routes.rb:
map.resources :scorecards do |scorecard|
2011 Feb 20
3
ugly url form_tag
Hi all
I am using form_tag helper and everything is sent by the get method.
In the url looks like :
http://localhost:3000/posts?utf8=%E2%9C%93&search=rails
The utf8 attributes is pretty much ugly.
Is there a way (in Rails 3) the url looks like something like :
http://localhost:3000/posts/search/rails
If yes what do I need to change in my code ?
Here is my code
<% form_tag posts_path,
2008 Jan 24
1
NoMethodError (undefined method `to_sym' for {"6"=>"1"}:Hash
I''ve got a search form that was working on rails 1.2.6, but since
upgrading to 2.0.2, I''m getting this error when I post my form. Here''s
the full error:
Processing SearchController#results (for 24.173.26.226 at 2008-01-24
14:51:23) [GET]
Session ID:
2007 Dec 13
4
please explain find_with_ferret, retrieve_records, :include and :conditions
Hello, I''m using find_with_ferret to search multiple models and it
works great. The trouble is I need to filter the results
using :include and :conditions.
I get two errors depending on the syntax I use in the search. Reading
the source, I see the retrieve_records method seems to filter
the :include and :conditions so that they only apply to the relevant
model when searching
2010 Nov 27
2
Something weird about draggable_element_js
Hi,
Because I want to create several draggable elements in a list, I''d
like to do the following:
<script type="text/javascript">
<%- elements.each do |element| -%>
<%= draggable_element_js("element_#{element.id}".to_sym, :revert
=> true) %>
<%- end -%>
</script>
However, if you''d try this in your app, you''ll
2006 Mar 03
7
Meta Programming Help
I have the following two methods:
def ProductFile::find_images(mode, prod_id)
# convert to symbol in case it is not (most commonly it may be a String)
mode = mode.to_sym
case mode
when :all, :first
ProductFile::find(mode, :conditions => ["product_id = ? AND
file_type LIKE ?", prod_id, "image%"])
end
end
def ProductFile::find_documents(mode,
2010 Aug 17
3
Rails 3 flash message problems
The following code in my application_helper.rb class either eats the
flash message or escapes it and does not display properly:
# Outputs the corresponding flash message if any are set
def flash_messages
messages = []
%w(notice warning error).each do |msg|
messages << content_tag(:div, content_tag(:p,
html_escape(flash[msg.to_sym])), :class => "message
2007 Oct 24
1
Stubbing Kernel.` (backquote)
I''m trying to stub(!) the Kernel.` (backquote) method and I''m having
confusing (to me) results. Here''s the method I''m spec''ing:
class Barcode
...
def raw_barcodes
self.make_temporary_copy
`OcrBarcode #{self.temp_file_path}`
end
...
end
And this is my (newbish) attempt at the spec:
describe "Calling @barcode.raw_barcodes" do
2007 Feb 16
6
some fun functionality for all your specs
I''ve found these two snippets of code useful and would love some feedback.
first, .should_have_valid_associations
usage:
context "A new Product" do
specify "should have valid associations" do
@product.should_have_valid_associations
end
end
code: (thanks to Wilson/Defiler for converting to rspec)
module Spec
module Expectations
module Should
2006 Jan 30
5
a RJS problem/patch
Hi,
add_rjs_to_action_view.rb of javascript_generator_templates
doesn''t work with setting Content-Type in a controller.
(e.g.) http://wiki.rubyonrails.org/rails/pages/HowtoSetDefaultEncoding
class ApplicationController < ActionController::Base
before_filter :set_charset
def set_charset
@headers["Content-Type"] = "text/html; charset=utf-8"
end
end
I
2009 Apr 16
6
Cucumber - step negating another expecting step
On 16 Apr 2009, at 11:22, Joaquin Rivera Padron wrote:
> at the moment I do it this way, hiding the complexity out of the
> steps:
>
> Then /^I should see the people search form$/ do
> people_search_form_exists
> end
>
> Then /^I should not see the people search form$/ do
> people_search_form_exists "not"
> end
>
> and then the method:
>
>
2006 Apr 07
2
Re: page.replace_html "#{var_containing_id_name}", :partial
Jeff Coleman <progressions@...> writes:
>
> Jason Tuttle wrote:
> > The subject line says it all. -- Is there a way to do something
like:
> >
> > page.replace_html "#{var_containing_id_name}", :partial => ''edit''
> >
> > That line of code does not work, but I would like to pass the
name of
> > a variable to
2006 Jan 19
5
123 * 3 => 123123123! But why?
Hi all
I extended the Globalize Plugin the following way:
--------
module Globalize
class Currency
def conversion_rate
code = Locale.active.currency_code
rates = { :USD => 1,
:CHF => 0.75,
:EUR => 1.1,
:GBP => 3.1
}
value = rates[code.to_sym]
raise "No conversion rate found for currency
2008 Jul 17
4
A Mongrel parsing bug: "&" and "&"
When using url_for to send path to a script (such as with
auto_complete), multiple params are joined with the "&" code. For
example:
text_field_with_auto_complete :blog :post, {}, { :posts_path(:a =>
1, :b => 2), :method => :get }
Produces this script:
var blog_post_auto_completer = new Ajax.Autocompleter(''blog_post'',
2011 Apr 30
8
"uninitialized constant PostsController::Post"
This time i read scaffold tutorial very carefully and finally try to
generate a form without using the scaffold(just used a controller and
view ).what i have done till now ,is as follow.Using rails 3.0.7.
"rails generate controller posts
index"
1) post_controller.rb
class PostsController < ApplicationController
def index
@post=Post.new