[Rails] Re: New to Ruby on Rails - Assigning variation (like size or color) to products
Top 3 book for Rails/Ruby Development 1. The Ruby Programming Language by David Flanagan & Yukihiro Matsumoto or 1. Programming Ruby 1.9 (3rd edition): The Pragmatic Programmers' Guide by by Dave Thomas, with Chad Fowler and Andy Hunt 2. The Rails Way by Obie Fernandez 3. Beginning Ruby: From Novice to Professional by Peter Cooper Also check codeschool.com they have a free ruby and free rails course, railscasts.com has many free higher level rails screencast & guides.rubyonrails.org has several rails guides If you are new to programming in general then try searching for information regarding Object-oriented programming if I understand you correctly just create a size variable for the product model or (this is where oop comes in) create a tshirt class which would inherit from the product class and give the tshirt class a size variable to be customized in the view. Hope this all helps -- 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 from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: save doesn't work in migration
Never mind, after some Googling, found reset_column_info to be my answer. On May 6, 10:18 pm, "Eric L." wrote: > I'm writing a migration to merge my first and last name fields into a > single name field. However, writing to the new name column doesn't > work within the migration. Why is this so? > > def self.up > add_column :users, :name, :string > > for user in User.all > user.name = user.first_name + ' ' + user.last_name > user.save! # <= name is not actually saved here. > end > > remove_column :users, :first_name > remove_column :users, :last_name > end --~--~-~--~~~---~--~~ 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] save doesn't work in migration
I'm writing a migration to merge my first and last name fields into a single name field. However, writing to the new name column doesn't work within the migration. Why is this so? def self.up add_column :users, :name, :string for user in User.all user.name = user.first_name + ' ' + user.last_name user.save! # <= name is not actually saved here. end remove_column :users, :first_name remove_column :users, :last_name end --~--~-~--~~~---~--~~ 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Question regarding has_one and association_build
In the doc, there's is a note saying association_build "only works if an association already exists. It will NOT work if the association is nil." But in my test, it works fine when the association is nil. For example, class Post < ActiveRecord::Base has_one :author def after_initialize build_author end end This works perfectly for me. So is the warning in the doc something I should be worried about? Link to doc: http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#M001790 Thanks, Eric --~--~-~--~~~---~--~~ 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Resource-based routing and controller module
I have a Request resource in my application. A "Request" is created by users of the system, but managed by administrators. For example, user creates a request to fix a chair, and administrator views and edits the request. As a result, I want to create two Request controllers: Admin::RequestsController and RequestsController. The latter is for users of the system to create requests, and lack the view, update, and delete actions, which are in Admin::RequestsController only. My problem is regarding routing. The simple "map.resources :requests" declaration in routes.rb only generates routes for the user RequestsController. Is there a way to have it route POST requests to the user RequestsController (with URL /requests), and route all other requests (PUT, GET, etc.) to Admin::RequestsController (with URL / admin/requests)? Thanks, Eric --~--~-~--~~~---~--~~ 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Security risks of cookie-based session storage
Good point. I realized risk #1 could be reduced by storing the secret in a secure place on the deployment server rather than under source control. On Feb 21, 3:20 pm, Frederick Cheung wrote: > On Feb 21, 5:06 pm, "Eric L." wrote: > > > Should I be concerned if I am using the default cookie-based session > > storage for a high security application? Nothing sensitive will be > > stored on the cookie, but it's critical that one user cannot gain > > access to another user's account. The security risks I see with > > cookie-based storage are: > > > 1. There is a single point of failure. If the secret key is stolen > > (for example, by a rogue developer), the person in possession of the > > key can log into any account he wishes. > > > 2. It's not been as widely used as database-backed session, and > > therefore not as tested. > > given that it's been the default for well over a year I would question > that. > > > 3. The cryptographic algorithm could be compromised, which is always a > > possibility (however unlikely.) > > While the risks in 1 and 3 do exist I don't think it's a game changer > compared to the other risks involved (people setting weak passwords, > the cryptographic algorithm securing your ssh or ssl sessions being > compromised and data being leaked that way, the rogue developer > harvesting data straight from the database, cookies being stolen via > XSS attacks etc.) > > 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: guides on css strategy
I had the same question when I was starting out with CSS. A lot of is simply trial and error, and you figure out what is best. Buy a good book on CSS (I read Bullet Proof CSS design), and that will give you some guidance as to what's the best class/id naming style. In general I follow these rules: 1. Use ID for unique element. 2. Use class for shared elements. 3. Scope CSS selector properly, so it's as specific as possible. It's a terrible thing to work on a code base where the previous developer specified style on something generic like ".first", then everything in the site that is of class "first" would be impacted by this style. On Feb 17, 5:44 pm, itsastickup wrote: > I'm having to design the UI to a small site, and that means dabbling > in css. I've never been able to get any kind of decent idea as to how > to decide on classes and id-ing. I've had a sniff around the internet > without success: people seem to be as clueless as me. I've even > examined the css/markup of a few sites and it hasn't been > enlightening. > > Does anyone know of a good source of info on css class decisions, and > ids? Even better with rails inm ind. Something that broke through for > you might be good. I'm not so interested in how css works: that's easy > to find, and I have a pretty good idea already. --~--~-~--~~~---~--~~ 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Security risks of cookie-based session storage
Should I be concerned if I am using the default cookie-based session storage for a high security application? Nothing sensitive will be stored on the cookie, but it's critical that one user cannot gain access to another user's account. The security risks I see with cookie-based storage are: 1. There is a single point of failure. If the secret key is stolen (for example, by a rogue developer), the person in possession of the key can log into any account he wishes. 2. It's not been as widely used as database-backed session, and therefore not as tested. 3. The cryptographic algorithm could be compromised, which is always a possibility (however unlikely.) What do you think? Eric --~--~-~--~~~---~--~~ 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---