Displaying 20 results from an estimated 1000 matches similar to: "Some documents not found"
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
2006 Jan 13
1
association callbacks
Hello all. I am looking for some feedback on an implementation. I''m writing
a plugin that will log all model changes. I do not want to have to add a
line a code for this functionality every time I create a model. Instead I
create a table with the name <model>_changes.
The basic stuff was easy:
base.after_create {|model|
model.log_create if model.has_backup_table?
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''
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",
2010 Oct 02
2
How to write a test hash for a nested form??
How to write a hash for a nested form??
Example form fields (main model is Practice, nested is User):
practice[name]
practice[users_attributes][0][email]
I want to do this:
post:
post :create, :practice => { :name => "any name", :users_attributes => {
:0 => { :email => "anyone-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" } } }
The issue is that I can not create
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 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
2006 Aug 04
4
DRY DRY DRY
Hello everyone!
Ive been on rails for the last month or so and really enjoyed this
framework.
However its very hard to find documentation on how to do things right!
For example every beginner after a while realizes that having similar
CRUD actions in every controller and views for them is not DRY at all!
Few days ago I found http://dereksivers.com/rails-shared-controller.html
I quite like his
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)",
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,
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
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
2011 Jul 26
0
active record wants root password, not sure why ..
When I run a command program (rails 3/ruby 1.9.2) as this:
class MsdsAttr < ActiveRecord::Base
include MsdsAttrModule
belongs_to :attribute_record, :polymorphic => true
has_many :attribute_values, :foreign_key => ''attribute_id''
has_many :alt_values, :as => :alternative
has_many :msds_ingredients
end
ActiveRecord::Base.establish_connection(
:adapter =>
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
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"
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 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:
2010 Nov 19
1
Help: delegated association 'App' returning ActionDispatch::Integration::Session instead
class Foo < ActiveRecord::Base
has_one :bar
delegate :app, :to => :bar
end
class Bar < ActiveRecord::Base
belongs_to :app
def self.attribute_column_names
return @@attr_columns if defined?(@@attr_columns)
readers = content_columns.map { |n| n.name.intern } -
[:created_at,:updated_at]
@@attr_columns ||= readers.map { |k| [k, "#{k}=".to_sym] }.flatten
end