Raimon Fs wrote in post #1047948:
Robert Walker wrote in post #1047899:
Raimon Fs wrote in post #1047848:
- Is it true that a slow queriy on RoR lock all other concurrent
connections? This was true on old RoR versions.
This could be true in many cases, but is this really different from PHP?
On 21.02.2012, at 11:23, sachin kewale wrote:
hi all,
i have one problem while encoding the special characters like
'',./?:!@#$%^*():;\{}[] ,I get string of book name containing some
special characters,
now i have to replace those characters with encoded value so i write
following
On Tue, Feb 21, 2012 at 8:15 AM, LED leedap...@gmail.com wrote:
hi guys im playing with RoR with the environment of rails 3 ruby 1.9 i
got stuck in
nil can't be coerced into BigDecimal
error
i need to get the total cost of the products inside the cart i know
where the problem is(i think)
Is there a business rule that each item must realistically have
a quantity and product (and that product must have a price) ?
uhm im following agile web development rails actualy the snippets are
from the book
* add validations for the presence of these values
(presence of quantity and
On Tue, Feb 21, 2012 at 9:48 AM, LED leedap...@gmail.com wrote:
Is there a business rule that each item must realistically have
a quantity and product (and that product must have a price) ?
uhm im following agile web development rails actualy the snippets are
from the book
* add
yes those data are valid actualy a while ago it worked but when i
clear and destroy the cart it returned to this error
very much appreciated for your effort thank you
On Feb 21, 4:51 pm, Peter Vandenabeele pe...@vandenabeele.com wrote:
On Tue, Feb 21, 2012 at 9:48 AM, LED leedap...@gmail.com
app/models/line_item.rb:24:in `*'
app/models/line_item.rb:24:in `total_price'
app/views/carts/show.html.erb:7:in `block in
_app_views_carts_show_html_erb___389431939__618846538'
activerecord (3.1.1)
lib/active_record/associations/collection_proxy.rb:91:in `each'
activerecord (3.1.1)
On 21.02.2012, at 11:15, LED wrote:
hi guys im playing with RoR with the environment of rails 3 ruby 1.9 i
got stuck in
nil can't be coerced into BigDecimal
def total_price
line_items.to_a.sum { |item| item.total_price }
end
model/cart.rb
That error would be expected when
On 20.02.2012, at 22:57, Oliver Fox wrote:
Hi all,
I'm submitting a form using jQuery, but in the respond_to block only the
format.html action is called.
This is the javascrip:
send_button.on('click', function(){
var form = $(this).closest('.modal').find('form');
nil can't be coerced into BigDecimal
def total_price
line_items.to_a.sum { |item| item.total_price }
end
model/cart.rb
That error would be expected when some of line_items.total_price returns
nil. Moreover you can sum total prices without .to_a, that would be more
efficient.
tried
i tried refactoring my destroy method now its working fine but my second
issue is when i add item to the cart at first attemp it returns to that
error again but returning to the product list it worked fine im just
wondering if my add_product is code is ok?
def add_product(product_id)
I didn't see you code completely, but
line_items.to_a.sum { |item| item.total_price }
How can it count correct if only ONE item in the cart? :)
Obviously, if you want to get Array, use Array.wrap method like this:
Array.wrap(line_items).sum { |item| item.total_price }
On 21.02.2012, at
Valery Kvon wrote in post #1047975:
I didn't see you code completely, but
line_items.to_a.sum { |item| item.total_price }
How can it count correct if only ONE item in the cart? :)
Obviously, if you want to get Array, use Array.wrap method like this:
Array.wrap(line_items).sum { |item|
On 21 February 2012 09:39, ruby LED li...@ruby-forum.com wrote:
Valery Kvon wrote in post #1047975:
I didn't see you code completely, but
line_items.to_a.sum { |item| item.total_price }
How can it count correct if only ONE item in the cart? :)
Obviously, if you want to get Array, use
def add_product(product_id)
current_item = line_items.where(:product_id = product_id).first
if current_item
current_item.quantity = current_item.quantity.to_i + 1
else
current_item = LineItem.new(:product_id=product_id)
line_items current_item
Colin Law wrote in post #1047978:
On 21 February 2012 09:39, ruby LED li...@ruby-forum.com wrote:
it feels like im adding a nil value at my first attemp of adding a
product into my cart?
It is not the item that is nil but total_price. If it were the item
that were nil then you would get an
Show us the code of LineItem class.
This method raises the error on a new instance. To avoid it, it must return
BigDec anytime. In your case product.price is nil or quantity is nil..
def total_price
product.price * quantity
end
On 21.02.2012, at 13:55, ruby LED wrote:
Colin Law wrote
Hey guys,
using passenger, is it possible that there could be thread safety issues
when executing a class method on a model?
I am seeing some weird data in some of my model instances and I think it
may be to do with concurrent processing of a class method in a model.
Is this possible, that
On Tue, Feb 21, 2012 at 10:55 AM, ruby LED li...@ruby-forum.com wrote:
Colin Law wrote in post #1047978:
On 21 February 2012 09:39, ruby LED li...@ruby-forum.com wrote:
it feels like im adding a nil value at my first attemp of adding a
product into my cart?
It is not the item that is
Valery Kvon wrote in post #1047982:
Show us the code of LineItem class.
This method raises the error on a new instance. To avoid it, it must
return BigDec anytime. In your case product.price is nil or quantity is
nil..
def total_price
product.price * quantity
end
class LineItem
Hello, something strange happened to my app, and i can't fogure out whats it.
for example when i type something in form field im wrting from right to left...
when i have horizontal unordered list , the first element is most to
the right too :/
does that ring a bell to anyone?
--
You received
On 21.02.2012, at 14:08, ruby LED wrote:
class LineItem ActiveRecord::Base
belongs_to :product
belongs_to :cart
def total_price
if product.price
product.price = product.price * quantity
else
0.to_d
end
end
end
So.
I agree that:
1) current_item =
On 21.02.2012, at 14:13, Marcin S wrote:
Hello, something strange happened to my app, and i can't fogure out whats it.
for example when i type something in form field im wrting from right to
left...
when i have horizontal unordered list , the first element is most to
the right too :/
hi im workiing on ruby on rails im just wondering if my add_product is
wrong because when i add my product in to my cart at first attemp it
fail and give me a
nil cannot concien bigdecimal error
but clicking return from my browser and add item at the second attemp it
worked fine and but didnt
2012/2/21 Valery Kvon adda...@gmail.com:
On 21.02.2012, at 14:13, Marcin S wrote:
Hello, something strange happened to my app, and i can't fogure out whats it.
for example when i type something in form field im wrting from right to
left...
when i have horizontal unordered list , the first
Valery Kvon wrote in post #1047990:
On 21.02.2012, at 14:08, ruby LED wrote:
end
end
So.
I agree that:
1) current_item = LineItem.new(:product_id=product_id) = BAD IDEA.
Because, if you pass the invalid product ID, LineItem would be
initialized as well, but the .product association
Thanks for your comments, I'll keep you informed with the news (good or
bad) :-)
--
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
Well you have at least two options to hide the parameters:
You could change your link_to call and include :method=:post so it does
actually send a post request. This doesn't really hide the parameters since
the user can still view the source of the page and look at them.
You could send them as
Hello,
I'm trying to make ActiveResource work with nested attributes and the
fields_for tag.
I started with a typical Rails application, with two ActiveRecord models
with one to many relationship (one band has many members).
In view 'bands/new.html.erb' I have something like this:
%=
Hi all
I am using Authlogic gem for authentication.I want an API
authentication for external API(XML) call.How to implement this in
authlogic .Thanks in advance...
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to this
I have a Rails 2.3.11 project that worked fine until I added the
config.ru file (required by POW). Now when I deploy to Apache/
Passenger, I get the error: Missing the Rails 2.3.11 gem. The
config.ru file contains the code I pulled form an old Rails guide:
require config/environment
use
I've got some ugly code I don't know how to improve on. I've got a
link_to tag that takes a fair amount of html as a block. I need the
href value for the link to be different depending on some logic, there
are four possible values for the href.
What I ended us with was this, and it's pretty
I have a form with a JavaScript requirement because the page loads a
JS file that creates a form input field with a certain Facebook-
autocomplete kind of style:
%= javascript_include_tag form_prettify_library %
div class=box
ul id=first_form class=tagitli class=prettify-new/li/ul
%=
Two positions open for permanent, on site full time developers
Visa candidates are welcome to apply. However, candidates must
already be residing in the United States
Client is offering a flexible work schedule after an acclimation
period, but will require a minimum of 3 days onsite
Salary: up to
2-3 years Ruby on Rails web development experience with proficiency in
a programming language and web application framework outside of Ruby
and Rails
Direct experience with the development and maintenance of large-scale,
mission-critical web applications
A solid understanding of database
After load testing my app, it started getting errors at 6 concurrent
users on a not-at-all heavy SQL operation page and I want to know how
to reduce these. I've read up about Connection Pooling but the
information out there is scarce. I'd like to increase my pool limit to
about 25-40 but what are
On Feb 21, 8:16 am, simpleton brand.magn...@gmail.com wrote:
After load testing my app, it started getting errors at 6 concurrent
users on a not-at-all heavy SQL operation page and I want to know how
to reduce these. I've read up about Connection Pooling but the
information out there is
Maybe just put the logic in the controller?
if @brand.nil?
if @store.nil?
@brand_link_path = from_catalog_path(params[:id].blank? ?
Category.root.id : params[:id], product.id, product.name_url)
else
@brand_link_path = from_store_path(@store.id, product.id)
end
else
Certainly not using Thread.new yet.
Thanks Fred.
--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to
On 21.02.2012, at 15:29, ruby LED wrote:
Valery Kvon wrote in post #1047990:
I agree that:
1) current_item = LineItem.new(:product_id=product_id) = BAD IDEA.
Because, if you pass the invalid product ID, LineItem would be
initialized as well, but the .product association would return
Hi,
I am trying to use the update method of activerecord with an array of
ids as the first param.
It does not update any row. The APIs say that it should work.
The array contains 2 IDs.
RSCampaign.update([1,2], {:end_date =
Date.strptime(120228,%y%m%d)})
If I put an ID instead of the array, it
On 21 February 2012 15:25, Rajarshi Chakravarty li...@ruby-forum.com wrote:
I am trying to use the update method of activerecord with an array of
ids as the first param.
It does not update any row. The APIs say that it should work.
What error message do you get? Do both of those IDs map to
PS. Why are you writing product.price=?
i belive it is same with product.price * quantity
to show the sum of all products inside my cart
Logic, logic, logic.
product - is a stand alone instance or One product. Why Would it ever
have the multiplied price with 'quantity' ?.
I remember
I am currently writing a search method for my rails applications and at
the moment it works fine. I have the following in my game.rb:
def self.search(search)
if search
find(:all, :conditions = ['game_name LIKE ? OR genre LIKE ? OR
console LIKE ?', %#{search}%, #{search}, #{search}])
else
I am currently writing a search method for my rails applications and at
the moment it works fine. I have the following in my game.rb:
def self.search(search)
if search
find(:all, :conditions = ['name LIKE ? OR genre LIKE ? OR
console LIKE ?', %#{search}%, #{search}, #{search}])
else
PS. Why are you writing product.price=?
i belive it is same with product.price * quantity
to show the sum of all products inside my cart
Logic, logic, logic.
product - is a stand alone instance or One product. Why Would it ever
have the multiplied price with 'quantity' ?.
I remember
IF you really need to search over several columns, use concat() for db
columns... like
scope :search, labda{|search| where(concat(name, genre, console) like ?,
%#{search}%).presence || all }
and then use
Model.search('value')
tom
On Feb 21, 2012, at 16:44 , Roger Patrick wrote:
I am
a href=/thang/frob data-remote=trueFrob/a
Aaand that's the correct output, because the JS changed to DRY up the
onclick handlers into rails.js:
document.on(click, a[data-remote], function(event, element) {
if (event.stopped) return;
handleRemote(element);
event.stop();
});
--
Hey,
I get no error message.
It just doesn't update any record.
Both the IDs are there in the DB table.
--
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
Hi ruby fans, Tickets are on sale now for RubyNation, DC's Ruby and
Rails developer conference. RubyNation will be held March 23-24th at
the Sheraton in Reston, Virginia.
Visit https://rubynation2012.busyconf.com/bookings/new to get your
ticket. We are just over 75% full (less than 50 tickets
Hey I found out my problem, it was because I did not have the % symbol
in the last two search calls, all works fine now.
Do you know how I would be able to make it as three separate search
boxes and buttons instead of all going in to one?
All I know is how to search every column under one form
On Feb 21, 2012, at 1:34 PM, Roger Patrick wrote:
Hey I found out my problem, it was because I did not have the % symbol
in the last two search calls, all works fine now.
Do you know how I would be able to make it as three separate search
boxes and buttons instead of all going in to one?
On 21.02.2012, at 19:25, Rajarshi Chakravarty wrote:
Hi,
I am trying to use the update method of activerecord with an array of
ids as the first param.
It does not update any row. The APIs say that it should work.
The array contains 2 IDs.
RSCampaign.update([1,2], {:end_date =
On 21.02.2012, at 19:25, Rajarshi Chakravarty wrote:
Hi,
I am trying to use the update method of activerecord with an array of
ids as the first param.
It does not update any row. The APIs say that it should work.
The array contains 2 IDs.
RSCampaign.update([1,2], {:end_date =
Vell--
With the asset pipeline, you don't include assets explicitly at
/assets/application.js
Instead, you use the asset pipeline and let it handle this for you. Re-read the
Asset pipeline Rails guide carefully, make sure your config.assets settings are
correct (remember, turned on by default
Thank you, Valery.
You are my hero.
Can you please post a link to the APIs?
--
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 rubyonrails-talk@googlegroups.com.
Take a serious look at ransack. It's a very neat search gem, and it
allows you to create specialized search fields just by naming those
It sounds really good Walter, do you have any links for Ransack, I just
googles ransack - rails but it hasn't provided me with a documentation
link.
Thanks
On 21.02.2012, at 23:42, Rajarshi Chakravarty wrote:
Thank you, Valery.
You are my hero.
Can you please post a link to the APIs?
api.rubyonrails.org
or
https://github.com/rails/rails/blob/d22592a05b299c21e30ec8b38890a178dca863b4/activerecord/lib/active_record/relation.rb#L312
people =
Do you have %= javascript_include_tag application % in your
layout?
On Feb 15, 11:13 am, Vell lovell.mcilw...@gmail.com wrote:
Hello all,
I am attempting to add some jquery to an application that I am developing
but I am having trouble getting my newly created .js file to load. I have
tried
On 21 Feb 2012, at 20:58, Roger Patrick wrote:
Take a serious look at ransack. It's a very neat search gem, and it
allows you to create specialized search fields just by naming those
It sounds really good Walter, do you have any links for Ransack, I
just
googles ransack - rails but it
Hi guys,
In Rails framework, I need to call the lightbox to add payment method
by using javascript method AuthorizeNetPopup.openAddPaymentPopup().
But based on the design, the popup should be triggered by other ways
not by clicking the normal button.
For example, users click signup button, the
I am using rails 2.3.5 and restful_authentication plugin.
User model is inherited by visitor, spotter and subscriber.
How to implement scoped_views for different user(visitor, spotter and
subscriber) registration.
--
You received this message because you are subscribed to the Google Groups Ruby
Rails 3.1.3
I have tables, Video and Script having association,
Video 1 --- n Script
So, every Script needs the parent id, in this case, video_id.
If I simply create a new Script instance, the view renders as follows.
%= render :partial = new_script, :locals = { :script =
I am using Rails 3 and Acts as taggable on in my application.
I am fetching the articles associated with the tag by
Article.tagged_with(tagname)
and
Blog.tagged_with(tagname)
Now i would like to collect all the users from the above i.e.., people
who are all posted articles and blogs with this
Bonjour,I'd like to filter the following table
tr
tha href=#Nom salle/a/th
tha href=#Nom machine/a/th
tha href=#Type d'incident/a/th
tha href=#Informations/a/th
th id=etata href=#Etat/a/th
tha href=#Date création/a/th
tha href=#Date résolution/a/th
tha href=#Actions/a/th
/tr
Hi Jeff,
I am facing same issue, do you have any solution ?
--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe
66 matches
Mail list logo