際際滷

際際滷Share a Scribd company logo
ACTS AS Andr辿 Tagliati @tagliati http://www.tagliati.com.br [email_address]
Tagliati E @makotovh papagaio de pirata
http://www.cowboycoded.com/tag/acts_as/   http://www.flickr.com/photos/loop_oh/3338084111/
DRY DONT REPEAT YOURSELF DRY http://www.flickr.com/photos/vorty/850290006/
Review Ou Acts as Reviewable REVIEWABLE
Hands On Vamos ver como 辿 isso. HANDS ON  http://www.flickr.com/photos/jurvetson/489257240/
rails g model  review review_text:text t.references  :reviewable ,  :polymorphic  =>  true
Ali! No teto!  Polymorphic!!!! Me enganei.   s坦 um PomboRanger.
class  Review < ActiveRecord::Base belongs_to  :reviewable ,  :polymorphic => true end module  Reviewable def  is_reviewable has_many  :reviews ,  :as => :reviewable ,  :dependent => :destroy include InstanceMethods end module  InstanceMethods def  reviewable? true end end end ActiveRecord::Base.extend Reviewable
class  Produto < ActiveRecord::Base is_reviewable end class  Categoria < ActiveRecord::Base is_reviewable end class  Artigo < ActiveRecord::Base is_reviewable end
http://www.flickr.com/photos/80835774@N00/5442336248/ hehaEHAEHaeHe haHeAHeAHeAHe HAEhae Assim fica f叩cil!
product = Product.new => # product.reviewable? => true product.reviews => []  #nenhum review ainda product.save product.reviews.create(review_text: &quot;test&quot;) => #<Review id: 1, reviewable_type: &quot;Product&quot;, reviewable_id: 101 ....> product.reviews.size => 1
BLOCOS
禽炭厩庄糸温壊?
Ad

Recommended

Intro to Laravel 4 : By Chris Moore
Intro to Laravel 4 : By Chris Moore
kareerme
Mantendo e mails sobre controle
Mantendo e mails sobre controle
m Peixoto
JavaScript as a First Class Language
JavaScript as a First Class Language
fabiopereirame
Libpunk0.01
Libpunk0.01
NextGen Library
Think Like An Entrepreneur (for GoToWebinar)
Think Like An Entrepreneur (for GoToWebinar)
Lane Becker
Social Media Tools That Work
Social Media Tools That Work
Jeffrey L. Cohen
My i spy
My i spy
Ethan
Our students won_t_research_the_way_we_did
Our students won_t_research_the_way_we_did
Nate Kogan
Growing Grails Software, Driven by Domain
Growing Grails Software, Driven by Domain
Yukei Wachi
17 nov 2020 nofollow backlinks
17 nov 2020 nofollow backlinks
EmmaRose49
Tools for Self-Awareness
Tools for Self-Awareness
Lori Cotten
Patterns in your Pastry
Patterns in your Pastry
James Watts
iCrocco
iCrocco
Dario Violi
Photoshop's New Groove
Photoshop's New Groove
Dan Rose
Dom XSS: Encounters of the3rd kind
Dom XSS: Encounters of the3rd kind
Bishan Singh
My i spy
My i spy
Ethan
Oow08slides
Oow08slides
Jake Kuramoto
Connecting the Open Social Web with OStatus (#FOWA2010)
Connecting the Open Social Web with OStatus (#FOWA2010)
Jon Phillips
Top 10 free image websites
Top 10 free image websites
KanikaGrover13
Braida seminario catas 12 giugno 2013 versione proiezione
Braida seminario catas 12 giugno 2013 versione proiezione
Alessandro Braida
Linkedinpowerpointfinal 124053772884 Phpapp02
Linkedinpowerpointfinal 124053772884 Phpapp02
jellez
The 1-2 Punch for Better Boards
The 1-2 Punch for Better Boards
Rolf Crocker
Business grammar
Business grammar
Adina Badea
Theres No 'I' in Team
Theres No 'I' in Team
Rolf Crocker
Los secretos mejor guardados de Madrid
Adina Badea
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Alliance
Securing Account Lifecycles in the Age of Deepfakes.pptx
Securing Account Lifecycles in the Age of Deepfakes.pptx
FIDO Alliance
FME for Good: Integrating Multiple Data Sources with APIs to Support Local Ch...
FME for Good: Integrating Multiple Data Sources with APIs to Support Local Ch...
Safe Software
FME for Distribution & Transmission Integrity Management Program (DIMP & TIMP)
FME for Distribution & Transmission Integrity Management Program (DIMP & TIMP)
Safe Software
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc

More Related Content

What's hot (11)

Growing Grails Software, Driven by Domain
Growing Grails Software, Driven by Domain
Yukei Wachi
17 nov 2020 nofollow backlinks
17 nov 2020 nofollow backlinks
EmmaRose49
Tools for Self-Awareness
Tools for Self-Awareness
Lori Cotten
Patterns in your Pastry
Patterns in your Pastry
James Watts
iCrocco
iCrocco
Dario Violi
Photoshop's New Groove
Photoshop's New Groove
Dan Rose
Dom XSS: Encounters of the3rd kind
Dom XSS: Encounters of the3rd kind
Bishan Singh
My i spy
My i spy
Ethan
Oow08slides
Oow08slides
Jake Kuramoto
Connecting the Open Social Web with OStatus (#FOWA2010)
Connecting the Open Social Web with OStatus (#FOWA2010)
Jon Phillips
Top 10 free image websites
Top 10 free image websites
KanikaGrover13
Growing Grails Software, Driven by Domain
Growing Grails Software, Driven by Domain
Yukei Wachi
17 nov 2020 nofollow backlinks
17 nov 2020 nofollow backlinks
EmmaRose49
Tools for Self-Awareness
Tools for Self-Awareness
Lori Cotten
Patterns in your Pastry
Patterns in your Pastry
James Watts
Photoshop's New Groove
Photoshop's New Groove
Dan Rose
Dom XSS: Encounters of the3rd kind
Dom XSS: Encounters of the3rd kind
Bishan Singh
My i spy
My i spy
Ethan
Connecting the Open Social Web with OStatus (#FOWA2010)
Connecting the Open Social Web with OStatus (#FOWA2010)
Jon Phillips
Top 10 free image websites
Top 10 free image websites
KanikaGrover13

Viewers also liked (6)

Braida seminario catas 12 giugno 2013 versione proiezione
Braida seminario catas 12 giugno 2013 versione proiezione
Alessandro Braida
Linkedinpowerpointfinal 124053772884 Phpapp02
Linkedinpowerpointfinal 124053772884 Phpapp02
jellez
The 1-2 Punch for Better Boards
The 1-2 Punch for Better Boards
Rolf Crocker
Business grammar
Business grammar
Adina Badea
Theres No 'I' in Team
Theres No 'I' in Team
Rolf Crocker
Los secretos mejor guardados de Madrid
Adina Badea
Braida seminario catas 12 giugno 2013 versione proiezione
Braida seminario catas 12 giugno 2013 versione proiezione
Alessandro Braida
Linkedinpowerpointfinal 124053772884 Phpapp02
Linkedinpowerpointfinal 124053772884 Phpapp02
jellez
The 1-2 Punch for Better Boards
The 1-2 Punch for Better Boards
Rolf Crocker
Business grammar
Business grammar
Adina Badea
Theres No 'I' in Team
Theres No 'I' in Team
Rolf Crocker
Los secretos mejor guardados de Madrid
Adina Badea
Ad

Recently uploaded (20)

FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Alliance
Securing Account Lifecycles in the Age of Deepfakes.pptx
Securing Account Lifecycles in the Age of Deepfakes.pptx
FIDO Alliance
FME for Good: Integrating Multiple Data Sources with APIs to Support Local Ch...
FME for Good: Integrating Multiple Data Sources with APIs to Support Local Ch...
Safe Software
FME for Distribution & Transmission Integrity Management Program (DIMP & TIMP)
FME for Distribution & Transmission Integrity Management Program (DIMP & TIMP)
Safe Software
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
Down the Rabbit Hole Solving 5 Training Roadblocks
Down the Rabbit Hole Solving 5 Training Roadblocks
Rustici Software
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Safe Software
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
Murdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementary
JorgeSemperteguiMont
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Safe Software
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
Data Validation and System Interoperability
Data Validation and System Interoperability
Safe Software
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
NTT DATA Technology & Innovation
From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
Edge AI and Vision Alliance
MuleSoft for AgentForce : Topic Center and API Catalog
MuleSoft for AgentForce : Topic Center and API Catalog
shyamraj55
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Alliance
Securing Account Lifecycles in the Age of Deepfakes.pptx
Securing Account Lifecycles in the Age of Deepfakes.pptx
FIDO Alliance
FME for Good: Integrating Multiple Data Sources with APIs to Support Local Ch...
FME for Good: Integrating Multiple Data Sources with APIs to Support Local Ch...
Safe Software
FME for Distribution & Transmission Integrity Management Program (DIMP & TIMP)
FME for Distribution & Transmission Integrity Management Program (DIMP & TIMP)
Safe Software
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
Down the Rabbit Hole Solving 5 Training Roadblocks
Down the Rabbit Hole Solving 5 Training Roadblocks
Rustici Software
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Safe Software
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
Murdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementary
JorgeSemperteguiMont
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Safe Software
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
Data Validation and System Interoperability
Data Validation and System Interoperability
Safe Software
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
NTT DATA Technology & Innovation
From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
Edge AI and Vision Alliance
MuleSoft for AgentForce : Topic Center and API Catalog
MuleSoft for AgentForce : Topic Center and API Catalog
shyamraj55
Ad

Act as

Editor's Notes

  • #4: Apresenta巽達o tomando como base explica巽達o em artigo de cowboycoded
  • #6: Criar um &apos;plugin&apos; que permita fazer reviews de um produto ou qualquer outra coisa
  • #9: Polymorphic relationships allow you to have a single model that can be associated to an arbitrary number of other model types. Example For instance, let&apos;s say you have a contacts database utilizing two models, Person and Company. Both people and companies have addresses that you want to store in the database, and you want to be able to query against all addresses at once (say for a location-based search). Polymorphic associations make this easy in Rails. Let&apos;s assume that you already have your Person and Company models created and are just creating your Address model. When you create your migration you will denote the polymorphic relationship using references: http://wiki.rubyonrails.org/howtos/db-relationships/polymorphic