hiddens fields in web form give error in php post - hidden-field

hiddens fields below in web form give error in php post, all other fields are ok
only hiddens although all have values as checked in chrome, well?
Notice: Undefined index: catHidden in C:\xampp\htdocs\VPS\PphCHnew\paypal\noPayPal.php on line 19
Notice: Undefined index: carIdHidden in C:\xampp\htdocs\VPS\PphCHnew\paypal\noPayPal.php on line 20
Notice: Undefined index: location in C:\xampp\htdocs\VPS\PphCHnew\paypal\noPayPal.php on line 23
Notice: Undefined index: location2 in C:\xampp\htdocs\VPS\PphCHnew\paypal\noPayPal.php on line 24
Notice: Undefined index: subTotal in C:\xampp\htdocs\VPS\PphCHnew\paypal\noPayPal.php on line 27
Notice: Undefined index: FinalAmount in C:\xampp\htdocs\VPS\PphCHnew\paypal\noPayPal.php on line 29
Notice: Undefined index: S1 in C:\xampp\htdocs\VPS\PphCHnew\paypal\noPayPal.php on line 36
Notice: Undefined index: S2 in C:\xampp\htdocs\VPS\PphCHnew\paypal\noPayPal.php on line 37
Notice: Undefined index: S3 in C:\xampp\htdocs\VPS\PphCHnew\paypal\noPayPal.php on line 38
Notice: Undefined index: GPS in C:\xampp\htdocs\VPS\PphCHnew\paypal\noPayPal.php on line 39
Notice: Undefined index: daysHidden in C:\xampp\htdocs\VPS\PphCHnew\paypal\noPayPal.php on line 47
Notice: Undefined index: discount in C:\xampp\htdocs\VPS\PphCHnew\paypal\noPayPal.php on line 51
Notice: Undefined index: rate in C:\xampp\htdocs\VPS\PphCHnew\paypal\noPayPal.php on line 59
Unable to execute query. Please try again later.565

Related

unsupported: Symbol in Cucumber on Rails

I am trying to call each on an ActiveRecord object/list in RoR as shown in the following chunk of code.
41 Then /I should (not )?see movies with ratings: (.*)/ do |not_see, rating_li>
42 #movies = Movie.where(:rating, rating_list.split(", "))
43 rating_list.split(",").map do |x|
44 x.strip
45 end.each do |rating|
46 if not_see
47 #movies.each do |movie|
48 #movie.title
49 end
50 else
51 puts "hello"
52 end
53 end
54 end
And this produces the following error message:
And I should not see movies with ratings: G, PG-13, NC-17 # features/step_definitions/movie_steps.rb:41
unsupported: Symbol (RuntimeError)
./features/step_definitions/movie_steps.rb:47:in `block (2 levels) in <top (required)>'
./features/step_definitions/movie_steps.rb:45:in `each'
./features/step_definitions/movie_steps.rb:45:in `/I should (not )?see movies with ratings: (.*)/'
features/filter_movie_list.feature:33:in `And I should not see movies with ratings: G, PG-13, NC-17'
Removing line 47 in the code above gets rid of the error. Why is that? As far as I can tell, all of these are valid Ruby code. What am I missing?
Thank you all!
The line of code that was causing the error is line 42. The call to where should have been:
Movie.where(:rating => rating_list.split(","))
"=>" and not ","

Rails 5: ActiveRecord collection index_by

Upgraded app to Rails 5 using the index method. The issue is that it is not incrementing to the next ActiveRecord collection record. The below code below use to work in Rails 4.0. Tried with index_by.
def next_question
index = campaign.quiz_questions.index self
campaign.quiz_questions[index + 1]
end
Debugger
(byebug) campaign.quiz_questions.index
*** NoMethodError Exception: undefined method `index' for #<QuizQuestion::ActiveRecord_Associations_CollectionProxy:0x007f80012d71b0>
Did you mean? index_by
Using index_by
(byebug) index = campaign.quiz_questions.index_by
#<Enumerator: #<ActiveRecord::Associations::CollectionProxy [#<QuizQuestion id: 113, campaign_id: 492, message: "Where did Hullabalooza's freak show manager send H...", created_at: "2016-07-20 20:50:32", updated_at: "2016-07-20 20:50:32">]>:index_by>
Index + 1
(byebug) index + 1
*** NoMethodError Exception: undefined method `+' for #<Enumerator:0x007fc4db445960>
nil
changed it to find_index method. Now it's working
def next_question
index = campaign.quiz_questions.find_index self
campaign.quiz_questions[index + 1]
end

Wicked PDF RuntimeError

I have installed Wicked PDF on rails 4, and now I have this issue:
RuntimeError in ClientsController#show
Error: Failed to execute: ["C:/Program Files/wkhtmltopdf/bin/wkhtmltopdf.exe", "--footer-center", "Center", "--footer-left", "Left", "--footer-right", "Right", "file://C:/Users/Rashid/AppData/Local/Temp/wicked_pdf20141017-9664-18xoryq.html", "C:/Users/Rashid/AppData/Local/Temp/wicked_pdf_generated_file20141017-9664-zo89le.pdf"] Error: PDF could not be generated! Command Error: Loading pages (1/6) [> ] 0% [======> ] 10% Error: Failed loading page file://c/Users/Rashid/AppData/Local/Temp/wicked_pdf20141017-9664-18xoryq.html (sometimes it will work just to ignore this error with --load-error-handling ignore) Exit with code 1 due to network error: ContentNotFoundError
def show
respond_to do |format|
format.html
format.pdf do
#example_text = "some text"
render :pdf => "file_name",
:template => 'clients/show.pdf.erb',
#:layout => 'pdf',
:footer => {
:center => "Center",
:left => "Left",
:right => "Right"
}
end
end
end
I was getting the same error and fixed it by following directions here
https://github.com/mileszs/wicked_pdf/issues/157
Namely I switched to tempory fix of gem by changing gemfile entry to:
gem 'wicked_pdf', github: 'mileszs/wicked_pdf'
I believe it has to do with using file:// instead of file:///.
Find wicked_pdf.rb in path/to/gem/wkhtmltopdf/bin, on line 64 replace file:// with file:///.

Why does undefined method `-#' for nil:NilClass mean (haml)?

I have this rails view partial and I just can't see the issue:
%span{class: "show_hide #{show_hide}"}
---------------------
= first_field_focus
---------------------
- if first_field_focus == "1"
- puts '++++++++++++'
- puts 'y'
- puts '.............'
- puts '.............'
- puts '==='
%a{href: '#', :data => {toggle_description_length: 'toggle'}} # Line 11
= raw(txt)
but I just keep getting:
NoMethodError in Links#index
Showing /home/durrantm/Dropnot/webs/rails_apps/linker/app/views/links/_toggle_details_link_bold.html.haml where line #11 raised:
undefined method `-#' for nil:NilClass
Extracted source (around line #11):
...
It means you're trying to call the - operator on something that is nil. Probably those --------------------- lines are being interpreted as a code line that's a chain of minus signs and it's confusing things. Try making it \--------------------- instead.

"no block given" errors with cache_money

i've inherited a site that in production is generating dozens of "no block given" exceptions every 5 minutes.
the top of the stack trace is:
vendor/gems/nkallen-cache-money-0.2.5/lib/cash/accessor.rb:42:in `add'
vendor/gems/nkallen-cache-money-0.2.5/lib/cash/accessor.rb:33:in `get'
vendor/gems/nkallen-cache-money-0.2.5/lib/cash/accessor.rb:22:in `call'
vendor/gems/nkallen-cache-money-0.2.5/lib/cash/accessor.rb:22:in `fetch'
vendor/gems/nkallen-cache-money-0.2.5/lib/cash/accessor.rb:31:in `get'
so it appears that the problem is in the cache money plugin.
has anyone experienced something similar?
i've cut and pasted the relevant code below -- anyone more familiar with blocks able to discern any obvious problems?
11 def fetch(keys, options = {}, &block)
12 case keys
13 when Array
14 keys = keys.collect { |key| cache_key(key) }
15 hits = repository.get_multi(keys)
16 if (missed_keys = keys - hits.keys).any?
17 missed_values = block.call(missed_keys)
18 hits.merge!(missed_keys.zip(Array(missed_values)).to_hash)
19 end
20 hits
21 else
22 repository.get(cache_key(keys), options[:raw]) || (block ? block.call : nil)
23 end
24 end
25
26 def get(keys, options = {}, &block)
27 case keys
28 when Array
29 fetch(keys, options, &block)
30 else
31 fetch(keys, options) do
32 if block_given?
33 add(keys, result = yield(keys), options)
34 result
35 end
36 end
37 end
38 end
39
40 def add(key, value, options = {})
41 if repository.add(cache_key(key), value, options[:ttl] || 0, options[:raw]) == "NOT_STORED\r\n"
42 yield
43 end
44 end
line 33 is calling add, but not passing a block, though one is expected on line 42 and there's no block_given? check like there is in the get method. There doesn't really seem to be an appropriate block to pass in this case, as the block passed to get is already yielded to in the add call on line 33, so passing it again separately to add is probably not correct.
Changing line 42 to yield if block_given? should fix your error in this case and shouldn't cause problems elsewhere.
It's also worth noting that line 42 is only called if something was not stored, so you may want to look into why that's happening.

Resources