[Rails] update_attributes() for a single column
I was just faced with a strange ROLLBACK exception when attempting to execute this code: $ rails console user = User.first User Load (1.1ms) SELECT users.* FROM users ORDER BY users.id ASC LIMIT 1 = #User id: 1, name: Michael Hartl, email: f...@bar.com, created_at: 2013-05-12 12:47:23, updated_at: 2013-05-12 13:24:26, password_digest: $2a $10$CYZFddDa5Glv0dlYhlpZguIuzfyMRiwleaenmh67hFyK... irb(main):005:0 user.update_attributes(email: 'exam...@railstutorial.org') (2.1ms) BEGIN User Exists (4.2ms) SELECT 1 AS one FROM users WHERE (LOWER(users.email) = LOWER('exam...@railstutorial.org') AND users.id != 1) LIMIT 1 (0.7ms) ROLLBACK = false There definitely is no user in the database (Postgres) matching given email. blog= \d users Table public.users Column |Type | Modifiers -+- + id | integer | not null default nextval('users_id_seq'::regclass) name| character varying(255) | email | character varying(255) | created_at | timestamp without time zone | updated_at | timestamp without time zone | password_digest | character varying(255) | Indexes: users_pkey PRIMARY KEY, btree (id) index_users_on_email UNIQUE, btree (email) The strange thing is that listing most of the fields in the update works (as instructed in the tutorial http://ruby.railstutorial.org/chapters/sign-up?version=4.0#top in the section of adding Gravatar). irb(main):007:0 user.update_attributes(name: 'Example User', email: 'exam...@railstutorial.org', password: 'foobar', password_confirmation: 'foobar') (3.0ms) BEGIN User Exists (0.9ms) SELECT 1 AS one FROM users WHERE (LOWER(users.email) = LOWER('exam...@railstutorial.org') AND users.id != 1) LIMIT 1 SQL (133.5ms) UPDATE users SET name = $1, email = $2, password_digest = $3, updated_at = $4 WHERE users.id = 1 [[name, Example User], [email, exam...@railstutorial.org], [password_digest, $2a $10$0i9ihaDD9nU6QxiGNiKEGeIarY9faPWY9lAAlLIzYz8UMyyz7R/mW], [updated_at, Sun, 19 May 2013 07:55:25 UTC +00:00]] (0.6ms) COMMIT how come? What connection do other fields bear with the ability to save the model? Here's the model: class User ActiveRecord::Base before_save { email.downcase! } validates :name, presence: true, length: { maximum: 50 } validates :email, presence: true, format: { with: /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/ i }, uniqueness: { case_sensitive: false } has_secure_password validates :password_confirmation, presence: true validates :password, length: { minimum: 6 } end Rails 4.0.0.beta1, Ruby ruby-2.0.0.0, ruby20-gems-1.8.25 -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Re: update_attributes() for a single column
class User ActiveRecord::Base before_save { email.downcase! } ... validates :password_confirmation, presence: true validates :password, length: { minimum: 6 } I now think it may be the peculiarity of the model: it validates presence of password confirmation, which makes no sense when password itself isn't or shouldn't be updated. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Ruby Problem update
Hello, I have always worked with ruby 1.8.7 on Linux Oracle from the depository available on the system. Today , I decide to install the latest version of ruby --V2.0.0 (from the ruby website). When I type : ruby -v, I have the result : ruby 1.8.7. Indeed, my OS doesn't recognize the update. May somebody help me ? JR -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/d591c320-2203-4651-808c-3fac9f11e109%40googlegroups.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] ASCII Control Sequences ANSI Standard X3.64 Sent By rSpec and Cucumber End Up Mess in Windows Shell
ANSICON, an open-source solution for displaying colors and formatting using ASCII Control Sequences (e.g. DEC-100), crashes when rSpec spits out its report to the Windows Shell.I speculated that Windows PowerShell (formerly Monad) would support colors and formatting, but it doesn't. I suppose the practical solution is to migrate to Linux, but that comes with a set of problems to solve that I'm not prepared to do whilst learning Ruby-on-Rails. I'm seeking comment on steps that are being undertaken to 1) display colors and formatting in the Windows Shell, or 2) eliminate the ASCII control sequences when the target platform is Windows. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/0c6fafd0-81b6-4271-ba11-d8fb27cf3629%40googlegroups.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Feedback on my first gem: United Attributes
I don't know if this is appropriate for this forum, so please kindly dicipline me, if I am out of line. :-) Some days ago, as I was working on a Rails project, it occured to me that numerical values on ActiveRecord objects can be kind of annoying to work with and I got an idea for a solution that would give me an opportunity to dwell into metaprogramming and gem development - two fields on which I have no prior experience. The basic idea is to declare the units used in numeral attributes and exploit that knowledge for formatting and conversion purposes. Perhaps this has already been done before, although I wasn't able to find anything in a few quick Google searches. Anyway, Instead of repeating myself, I'd like you to skim the README on this new project of mine: https://github.com/nielsbuus/united_attributes I would really appreciate feedback on whether this is a good idea. And secondly, if you have the time, I'd would be nice to get some feedback on the details of the implementation as well. I know it has no specs yet, but that's because I'm using a Try-Driven Development process whenever venturing into new things. =) // Niels Buus -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ca689a82-dcef-499d-a641-ca473677e20b%40googlegroups.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] ActionMailer: Remove Content-ID from multipart emails
Hi, Already asked this question in StackOverflow, but as not responses arrive, decided to give it a try here :) I'm using action mailer to send emails with both html and plain text version. Something like this: mail(:to = 'exam...@example.com', :subject = 'Test message', :from = 'sen...@example.com') do |format| format.text { render :text = 'test2' } format.html { render :inline = 'ptest/p' } end In my real application, i'm also not using templates because the content of the email comes entirely from the database. Is there a way to remove the Content-ID from the generated email? I ask this because i identified that this Content-ID cause some issues with email clients like Zimbra ( http://www.zimbra.com/ ). In this case, the *text part* is identified as an attachment. A sample email that is sent ( without all headers to reduce the size ): Subject: Test message Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=--==_mimepart_51968c0793776_ae993feec08349d036897; charset=UTF-8 Content-Transfer-Encoding: 7bit ==_mimepart_51968c0793776_ae993feec08349d036897 Date: Fri, 17 May 2013 16:59:03 -0300 Mime-Version: 1.0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-ID: 51968c07954fb_ae993feec08349d03...@failpc.mail ptest/p ==_mimepart_51968c0793776_ae993feec08349d036897 Date: Fri, 17 May 2013 16:59:03 -0300 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-ID: 51968c0794e19_ae993feec08349d036...@failpc.mail test2 ==_mimepart_51968c0793776_ae993feec08349d036897-- See the Content-ID: 51968c0794e19_ae993feec08349d036...@failpc.mail? I need to remove it. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/cb116e6a-b5c9-4cdb-9f43-868e477fecf8%40googlegroups.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Make a column data unique for each user_id
This is my setup. I have a table user where all user with password and so on are set. The customer table has some customer related data. The user_id is the foreign key to relate the customers to the user. On of the column in the customer table is the customernumber. These numbers has to be uniq for each user_id. class Customers belongs_to :user end class Users has_many :customers end For example. customer | customernumber | user_id 1 00011 2 00021 3 00012 4 00013 5 00023 How can i approach this? Any hints what I have to look for? thanks in advance best regards denym -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/351e0d0d-a672-4a7e-95e4-43db470e90e0%40googlegroups.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Active Admin with Ajax call
Hello everyone. I'm begining with Ruby on Rails, and i'm facing some trouble with ActiveAdmin with ajax. Here's the situation: It's a Kennel's web site, so, while i'm creating a new dog, i have one select/options for the dog's father, dog's mother, and dog's race. After select the dog's father/mother i can be able to know the race from the dog i'm creating, so i need to dynamically fill the race's option, accordinggly with his father's or mother's race. I know i need a javascript/ajax, and i know hot to do it with php i know it's pretty simple but as i'm new with Ruby on Rails, i don't know where and how to write these codes in active admin. If anyone could help, thanks so much! =) -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/e2431c08-529e-4280-b72a-92c184b1ee42%40googlegroups.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] [JOBS] Full-time RoR Engineer, San Francisco @ Small, Fast-growing Mobile Company
* Join us at Playground Worlds, where we’ve made it our mission to create the first virtual world for fun and play on mobile. We create experiences that are simple, engaging, and entertaining. We believe in teamwork, intellectual honesty and excellence. We take ownership of our work, constantly question our assumptions, and only ship products we are proud to put our names on (though that doesn’t stop us from iterating quickly!). Our founding team includes some of the best designers and developers in the industry, with experience releasing over 50 top 25 mobile applications totalling over 35 million installs. We are looking for a RoR Backend Engineer who is passionate, talented, shares similar values and is looking to join our small family. Responsibilities - Lead server-side application development while interfacing with iPhone Android developers - Adopt and own at least 20k lines of existing Ruby on Rails code - Optimize servers for scalability, efficiency and maintainability - Solve cutting-edge technical challenges - Maintain high code quality, maintainability and documentation Requirements - Fluency in Ruby on Rails application development (Ruby 1.9.x) - Deep understanding of Computer Science fundamentals (OOP, data structures, algorithms) - A long-term thinker who is committed to excellence, teamwork, and intellectual honesty This is a full time position based in downtown San Francisco. Please contact Anton at an...@letsflick.com for more info.* -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/936d15bd-43b7-4929-9f7b-00ca70553b89%40googlegroups.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Re: update_attributes() for a single column
On Sunday, May 19, 2013 9:14:47 AM UTC+1, rihad wrote: I now think it may be the peculiarity of the model: it validates presence of password confirmation, which makes no sense when password itself isn't or shouldn't be updated. That is indeed weird - the only validation I've ever used in conjunction with the confirmation field is validates_confirmation_of. You can check user.errors to see all the errors rails thinks the object has. Fred -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/96210449-c5ed-4d43-b0aa-4f848de4efbd%40googlegroups.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Re: update_attributes() for a single column
Did you define: attr_accessible :email, :name, :password, :password_confirmation, .. #other attributes if needed On Sunday, 19 May 2013 10:37:50 UTC+2, Frederick Cheung wrote: On Sunday, May 19, 2013 9:14:47 AM UTC+1, rihad wrote: I now think it may be the peculiarity of the model: it validates presence of password confirmation, which makes no sense when password itself isn't or shouldn't be updated. That is indeed weird - the only validation I've ever used in conjunction with the confirmation field is validates_confirmation_of. You can check user.errors to see all the errors rails thinks the object has. Fred -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/7e732897-b99e-4332-b347-a85c19ac2435%40googlegroups.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Re: update_attributes() for a single column
On May 19, 1:37 pm, Frederick Cheung frederick.che...@gmail.com wrote: That is indeed weird - the only validation I've ever used in conjunction with the confirmation field is validates_confirmation_of. You can check user.errors to see all the errors rails thinks the object has. Thanks, it was indeed missing password + confirmation causing the ROLLBACK. irb(main):004:0 user.errors = #ActiveModel::Errors:0x29fe1b30 @base=#User id: 1, name: Example User, email: exa...@railstutorial.org, created_at: 2013-05-12 12:47:23, updated_at: 2013-05-19 07:55:25, password_digest: $2a $10$0i9ihaDD9nU6QxiGNiKEGeIarY9faPWY9lAAlLIzYz8U..., @messages={:password_confirmation=[can't be blank], :password=[is too short (minimum is 6 characters)]} has_secure_password must be something new in Rails 4. It does everything validates_confirmation_of does. And attr_accessible also seems to have become a thing from the past. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Re: update_attributes() for a single column
Validation should be conditional. Considering that both password and password_confirmation are virtual and are never saved to the database (only password_digest, a special field expected by has_secure_password), their validation should be special cased (like only password being present to signify desire to change it, thus trigger the confirmation check). -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Rails] Ruby Problem update
HOW did you installed 2.0 and WHERE did you put the binaries? Did you remember to update your path? If you used rvm, did you remember to load it in bashrc (or similar)? 2013/5/18 Jean-René Saint-Etienne jeanrene97...@gmail.com Hello, I have always worked with ruby 1.8.7 on Linux Oracle from the depository available on the system. Today , I decide to install the latest version of ruby --V2.0.0 (from the ruby website). When I type : ruby -v, I have the result : ruby 1.8.7. Indeed, my OS doesn't recognize the update. May somebody help me ? JR -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/d591c320-2203-4651-808c-3fac9f11e109%40googlegroups.com?hl=en-US . For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Rails] Make a column data unique for each user_id
On Sat, May 18, 2013 at 8:14 AM, Denny Mueller macda...@googlemail.com wrote: This is my setup. I have a table user where all user with password and so on are set. The customer table has some customer related data. The user_id is the foreign key to relate the customers to the user. On of the column in the customer table is the customernumber. These numbers has to be uniq for each user_id. Is this a legacy database you're trying to use with Rails? It doesn't appear to follow Rails conventions. In this example, is customer a unique auto-generated identifier? If so, why do you need customernumber to also be unique? If not, what is it? customer | customernumber | user_id 1 00011 2 00021 3 00012 4 00013 5 00023 -- Hassan Schroeder hassan.schroe...@gmail.com http://about.me/hassanschroeder twitter: @hassan -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yCvXDs86nz5%2BYgrpaaDqEbOvVRLcWx%3DQbioNhyeJPh7pg%40mail.gmail.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Rails] Active Admin with Ajax call
On May 17, 2013, at 3:35 PM, Bruno Sapienza wrote: Hello everyone. I'm begining with Ruby on Rails, and i'm facing some trouble with ActiveAdmin with ajax. Here's the situation: It's a Kennel's web site, so, while i'm creating a new dog, i have one select/options for the dog's father, dog's mother, and dog's race. After select the dog's father/mother i can be able to know the race from the dog i'm creating, so i need to dynamically fill the race's option, accordinggly with his father's or mother's race. I know i need a javascript/ajax, and i know hot to do it with php i know it's pretty simple but as i'm new with Ruby on Rails, i don't know where and how to write these codes in active admin. If anyone could help, thanks so much! =) If you're beginning with RoR, I would seriously encourage you to first build an entire site with nothing but the core Rails framework -- no extras at all. I tried using Hobo very early in my Rails career, and I feel like it set me back quite a ways. These engines and meta-frameworks enforce their own logic on top of Rails' and this can cause you to miss some basic concepts that you will need later. Walk then run, IOW. Walter -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Rails] Feedback on my first gem: United Attributes
On May 17, 2013, at 9:48 PM, Niels Buus wrote: I don't know if this is appropriate for this forum, so please kindly dicipline me, if I am out of line. :-) Some days ago, as I was working on a Rails project, it occured to me that numerical values on ActiveRecord objects can be kind of annoying to work with and I got an idea for a solution that would give me an opportunity to dwell into metaprogramming and gem development - two fields on which I have no prior experience. The basic idea is to declare the units used in numeral attributes and exploit that knowledge for formatting and conversion purposes. Perhaps this has already been done before, although I wasn't able to find anything in a few quick Google searches. Anyway, Instead of repeating myself, I'd like you to skim the README on this new project of mine: https://github.com/nielsbuus/united_attributes I would really appreciate feedback on whether this is a good idea. And secondly, if you have the time, I'd would be nice to get some feedback on the details of the implementation as well. I know it has no specs yet, but that's because I'm using a Try-Driven Development process whenever venturing into new things. =) This is really cool, thanks for doing this! I can see a problem ahead for currency -- I built a currency converter a while back that relied on a lookup of the current day's exchange rates. Not a pretty thing. You sort of tease at that with your £ vs # when discussing the duck, just letting you know that while your premise is extremely tight, and your execution as I see it here is really neatly done, that particular detail will make you cry when it comes time to make it real. Walter // Niels Buus -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ca689a82-dcef-499d-a641-ca473677e20b%40googlegroups.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Rails] Active Admin with Ajax call
On May 19, 2013, at 11:36 AM, Walter Lee Davis wrote: On May 17, 2013, at 3:35 PM, Bruno Sapienza wrote: Hello everyone. I'm begining with Ruby on Rails, and i'm facing some trouble with ActiveAdmin with ajax. Here's the situation: It's a Kennel's web site, so, while i'm creating a new dog, i have one select/options for the dog's father, dog's mother, and dog's race. After select the dog's father/mother i can be able to know the race from the dog i'm creating, so i need to dynamically fill the race's option, accordinggly with his father's or mother's race. I know i need a javascript/ajax, and i know hot to do it with php i know it's pretty simple but as i'm new with Ruby on Rails, i don't know where and how to write these codes in active admin. If anyone could help, thanks so much! =) If you're beginning with RoR, I would seriously encourage you to first build an entire site with nothing but the core Rails framework -- no extras at all. I tried using Hobo very early in my Rails career, and I feel like it set me back quite a ways. These engines and meta-frameworks enforce their own logic on top of Rails' and this can cause you to miss some basic concepts that you will need later. Walk then run, IOW. Here's an article that really expands on this idea. http://everydayrails.com/2012/07/31/rails-admin-panel-from-scratch.html You might give it a quick read and see if you agree with my premise. Walter -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] relationship of shopping cart and order
Most implementations of shopping carts I have seen is that a user stores line items in a cart, where the line items represent products or subscriptions. So a cart has many products through line items and a product can have many carts through line items. Then a customer makes an order and so you introduce a new model order. The order has information such as customer's name, the payment type, and if you are working with a payment gateway, such as paypal, it will contain paypal tokens and recurring tokens. So the order and the cart are two different models, two different purposes. Cart is a thing that enables a customer to store things in, and a order is the thing that handles payments. So I was watching this railscasts and he updates a purchased_at attribute on the cart itself: http://railscasts.com/episodes/142-paypal-notifications?view=comments But is a cart really purchased, or is it the order that is purchased? If the order contains all payment information, shouldn't the order contain the purchased_at attribute and not the cart? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] acts_as_list crashes with non-numeric id
Seems to me acts_as_list has a bug -- I have data where the row id is a random alphaNumeric, not a simple integer. Using acts_as_list with a scope of a related model id, acts_as_list crashes the app due to a faulty query in MySQL something like this: class LineItem ActiveRecord::Base belongs_to :order acts_as_list :scope = :order_id end Unknown column 'UXPzIdeIuIFkz6n' in 'where clause': UPDATE `line_items` SET position = (position - 1) WHERE (order_id = UXPzIdeIuIFkz6n AND position 5) I've been trying several ways to force substition to generate those needed quotes myself, but so far no luck. Anyone battle solve this? Thx. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/90d4263bed35117280a5e2af66c86980%40ruby-forum.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Re: relationship of shopping cart and order
It important to keep in mind that the episode is focused on PayPal notifications, not describing a fully fleshed out e-commerce domain model. Spree[1] provides a better example of a fully implemented domain model. In Spree, the concept of a 'cart' is implemented using a current order. When an item is added to the 'cart', it's actually added to the current order in progress. I guess it's not that different from the RailsCast example, where cart == order. In the past, when developing custom commerce platforms I have tried it both ways: creating a cart and then migrating it to an order when purchased; and just working with an order throughout. Using one domain model, order with lifecycle states, is a lot simpler. [1] http://www.spreecommerce.com On Sunday, May 19, 2013 2:18:54 PM UTC-4, John Merlino wrote: Most implementations of shopping carts I have seen is that a user stores line items in a cart, where the line items represent products or subscriptions. So a cart has many products through line items and a product can have many carts through line items. Then a customer makes an order and so you introduce a new model order. The order has information such as customer's name, the payment type, and if you are working with a payment gateway, such as paypal, it will contain paypal tokens and recurring tokens. So the order and the cart are two different models, two different purposes. Cart is a thing that enables a customer to store things in, and a order is the thing that handles payments. So I was watching this railscasts and he updates a purchased_at attribute on the cart itself: http://railscasts.com/episodes/142-paypal-notifications?view=comments But is a cart really purchased, or is it the order that is purchased? If the order contains all payment information, shouldn't the order contain the purchased_at attribute and not the cart? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/70a81e86-b082-49eb-a507-64c96a1120d5%40googlegroups.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.