Archive for February, 2012

Why should your business exist

“Why should your business exist? That is the core question to answer for any firm. The presentation shows how you find great answers to this question.”

  • http://www.slideshare.net/pstaehler/why-should-your-business-exist-11651414

Startups and Books

After Startupcamp Switzerland 2012, these are some book that are in my “To Read” list.

The Lean Startup: How Constant Innovation Creates Radically Successful Businesses

Most new businesses fail. But most of those failures are preventable. This title offers a fresh approach to business that’s being adopted around the world. It describes learning what your customers really want, testing your vision continuously, and adapting and adjusting before it’s too late.

BookdepositoryAmazon.co.uk

 

Technology Ventures: From Idea to Enterprise
- Textbook for the Technology Entrepreneurship course, 2012, from Stanford University.

For business, engineering, and science students and professionals who demand a comprehensive guide to high-growth entrepreneurship, Technology Ventures is the leading resource for analyzing opportunities and building new enterprises.

BookdepositoryAmazon.co.uk

 

Extreme Toyota

Extreme Toyota offers the first real, comprehensive inside look at what makes one of the world?s best companies run. What they uncovered will surprise you and change the way you think about business. Simultaneously rigidly traditional and seriously innovative, it is precisely those internal contradictions that make the company so successful and admired.

Bookdepository - Amazon.co.uk

 

Do you have any other suggestions on what to read?

Rails – Nested forms and has_one relationship

I was trying to build a nested form with Rails 3.1, using models that had a “has_one” relationship. The form would show the parents fields but not the nested models field.

So I started by defining the has_one relationship in the models and adding “accepts_nested_attributes_for to the Parent :

class Parent < ActiveRecord::Base
  has_one :child, :dependent => :destroy
  accepts_nested_attributes_for :child
 end
 
 class Child < ActiveRecord::Base
  belongs_to :parent
 end

Just this wasn’t enough. The solution involves initializing the Child by the Parent. This can be done in the Controller or the Model.

In the Model:

class Parent < ActiveRecord::Base
has_one :child, :dependent => :destroy
accepts_nested_attributes_for :child
 
after_initialize do
  self.child ||= self.build_child()
end
end

Or in the Controller:

class ParentsController < ApplicationController
def new
  @parent = Parents.new
  @parent.build_child
 end
end

So, a question, where is the best place to initialize the Child? In the Parents Controller or Model?