Displaying 20 results from an estimated 137 matches for "to_sym".
Did you mean:
to_svm
2011 Jul 11
2
Can't get this Rspec test to pass
...anager_for_(.*)/
return honors_scope_of($1, args) if name.to_s =~
/^honors_scope_of_(.*)/
return current_scope_for($1) if name.to_s =~
/^current_scope_for_(.*)/
super
end
def current_scope_for(scope)
Thread.current[scope.to_sym]
end
def acts_as_scope_manager(scope, *args)
options = args[0].extract_options! if args
send :include, InstanceMethods
set_global_scope(scope,options[:with_global_scope]) if
options[:with_global_scope]
send :before_filter, "set_scope_for_#{sco...
2006 Feb 01
3
Getting database config info
Hi folks. I have a very small problem which is probably very simple. But
I''ve scoured the api and the rails book with no luck.
I''m trying to get information about the database definition out of active
record. When I go into console and say
ActiveRecord::Base.connection
I get a MysqlAdapter object, with an instance variable called @config that''s
a hash containing all
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", "ENV2"]:Array
The "environment" variable is part of the LDAP node definition and in this
case, the node in...
2006 Dec 20
0
undefined method `to_sym' for #<YAML::Syck::MergeKey...
...cript/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'' for
#<YAML::Syck::MergeKey:0xb71dfa6c>
to_sym is indeed *not* defined in /usr/lib/ruby/1.8/yaml.rb or
/usr/lib/ruby/1.8/yaml/*
What''s going on here?
Thanks,
--Dean
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscrib...
2010 Apr 17
1
Nil.to_sym Problem
HI everyone, require some help! cannot figure out this error and how
to fix it!
Showing user/index.html.erb where line #59 raised:
You have a nil object when you didn''t expect it!
The error occurred while evaluating nil.to_sym
Extracted source (around line #59):
56: <% end %>
57: </ol>
58:
59: <div id="hub">Blog: <%= link_to "(manage)", posts_path(@blog) %></
div>
60: <div id="hubtwo"><%= render :partial => "user/blog" %></div>
6...
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 see that this won''t
work, because the quotes around the ID in the generated javascript are
converted to the HTML-equivalent (").
Is this a bug or am I...
2008 Oct 25
2
Update action | NoMethodError | nil.to_sym
...</tr>
ROUTES:
map.resources :employees
All pretty standard stuff - what''s going on?
ERROR:
NoMethodError in Employees#edit
Showing employees/edit.html.erb where line #5 raised:
You have a nil object when you didn''t expect it!
The error occurred while evaluating nil.to_sym
Extracted source (around line #5):
2: <div id="main-sub">
3: <%= error_messages_for :employees %>
4:
5: <% form_for(@employee) do |f| %>
6: <table width="600" border="0">
7: <tr>
8: <td class="label">Email:
T...
2009 Apr 16
6
Cucumber - step negating another expecting step
.../^I should not see the people search form$/ do
> people_search_form_exists "not"
> end
>
> and then the method:
>
> def people_search_form_exists negation = ""
> neg = "_not" unless negation.blank?
> response.send "should#{neg}".to_sym, have_tag(''form#frmSearch'')
> end
>
> this is a simple case, but what do you think about this? any blog
> post or so
Yeah this is an annoying one isn''t it. I sometimes get around it by
going old-skool and pulling out the Test::Unit assertion methods
ins...
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, prod_id)
mode = mode.to_sym
case mode
when :all, :first
Product...
2007 Dec 13
4
please explain find_with_ferret, retrieve_records, :include and :conditions
...@query,
{ :multi => [ Artist], :page => params[ :page ], :per_page
=> 10 },
{ :include => {:media_files => {}}, :conditions =>
[ "media_files.file and inventories.status = ''donated''" ] } )
# Resulting Error
undefined method `to_sym'' for [:media_files, {}]:Array
# Second try. I put the :include params in [] array brackets to see if
that would help the to_sym error. That fixes the to_sym error. But now
the association isn''t getting found?
@results = Inventory.find_with_ferret( @query,...
2007 Sep 25
16
putting away HashWithIndifferentAccess
...so we need a replacement.
I''m not too hot on [symbol] and [string] equivalence. But I do like
to call the query string vars like methods. What do you think about
using OpenStruct instead?
I''ve been testing with this:
class H < OpenStruct
def u h;for k,v in h;@table[k.to_sym]=v;new_ostruct_member(k);end
def self.[] *a;new *a;end
en
Or, you know, just Hash is okay, right folks?
_why
2008 Jan 24
1
NoMethodError (undefined method `to_sym' for {"6"=>"1"}:Hash
...rch"=>{"form"=>"advancedsearch", "keyword"=>"oil"}, "x"=>"17",
"y"=>"13", "action"=>"results", "controller"=>"search"}
NoMethodError (undefined method `to_sym'' for
{"6"=>"1"}:HashWithIndifferentAccess):
/usr/lib64/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/base.rb:420:in
`template_format''
/usr/lib64/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/base.rb:396:in
`pick_template_extension'...
2006 Jan 13
1
association callbacks
...s
def append_habtm_callbacks
reflect_on_all_associations.each{ |association|
if association.macro == :has_and_belongs_to_many
#add_callback
add_callback = "before_add_for_#{association.name}"
class_inheritable_reader(add_callback.to_sym)
write_inheritable_array(add_callback.to_sym, [:log_add])
#remove_callback
remove_callback = "before_remove_for_#{association.name}"
class_inheritable_reader(remove_callback.to_sym)
write_inheritable_array(remove_callback.to_sym,...
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 `validate''
activemodel (3.2.2) lib/active_model/validator.rb:150:in `each''
acti...
2010 Aug 17
3
Rails 3 flash message problems
...ss 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 #{msg}") unless
flash[msg.to_sym].blank?
end
messages
end
I am not sure how to make it html_safe so that Rails 3 renders it
properly. No problems with Rails 2.3.8, but I had to mark the entire
method "safe_method" using rails_xss plugin.
I...
2007 Oct 24
1
Stubbing Kernel.` (backquote)
...temp_file_path}`
end
...
end
And this is my (newbish) attempt at the spec:
describe "Calling @barcode.raw_barcodes" do
before(:each) do
File.stub!(:exist?).and_return(true)
@barcode = Barcode.new(''path/to/valid.pdf'')
Kernel.stub!(''`''.to_sym)
end
it "should make a copy of the file" do
@barcode.should_receive(:make_temporary_copy)
@barcode.raw_barcodes
end
it "should make a system call to OcrBarcode"
it "should make the system call to OcrBarcode passing in the
temporary copy of the file"...
2006 Jun 15
8
rails saves it to the database and I don''t want to
Hello:
I am developing a web application to book machines for an event.
so I have an event model
class Event < ActiveRecord::Base
has_many :datetimes
...
end
and a datetime model
class Datetime < ActiveRecord::Base
belongs_to :event
...
end
I have developed a view with the event information and information for
the datetimes. and in the event_controller when I capture a datetime I
2006 Sep 26
4
Some documents not found
...ids of every product for caching purposes...
ids = products.collect {|p| p.id}
# pre-cache all the keywords for the products
kwcache = {}
Vandelay::Keyword.find_by_sql(["select productId, term from
product_keywords where productId in (?)", ids]).each {|kw|
sym = kw.productId.to_sym
kwcache[sym] = [] if !kwcache[sym]
kwcache[sym] << kw.term
}
# pre-cache all the attribute values for the products
attr_cache = {}
Vandelay::ProductStringAttribute.find_by_sql(["select productId, name,
value from product_stringattribute where productId in (?)", ids...
2007 Feb 16
6
some fun functionality for all your specs
...'' route. assigns[:cart] = @cart = mock("cart")
@cart.stub!(:attr_name).and_return(''cart'')
@cart.stub!(:to_param).and_return(''99'')
@cart.stub!(:class).and_return(Cart)
Cart.content_columns.each { |c|
@cart.stub!(c.name.to_sym)
}
Cart.reflect_on_all_associations.each do |assoc|
@cart.stub!(assoc.name.to_sym).and_return([])
end
@cart.stub!(:name).and_return(''cart'')
As you can see it rapidly spirals out of control, but this snippet
sets up all the associations and field names as stu...
2005 Dec 22
1
[NEWB] How to access database.yml parameters in a controller
Hi,
Are the active database.yaml attributes for the current environment
(dev, prod, test) available inside a controler ?
adapter, host, db, socks, etc.
AFIK Class#connection don''t give back theses infos.
Thanks