SlideShare a Scribd company logo
Architecture Rails:
Controllers: Rails look to find controllers classes. A controllers handles a web request from user.
Views: Holds the display templates to fill in with data from our application, convert to HTML, and
return to the user's browser.
Models: Holds the classes that model and wrap the data stored in our application's database.
Helpers: Holds any helper classes used to assist the model, view, and controllers classes
Methods:
link_to → creates a hyperlink to an action
example: <%= link_to "Hello", say_hello_path %>
Marshaling Objects: Take an object and convert it into a stream of bytes that can be stored outside the
app.
rails generate migration add_columnname_to_tablename columnname:datatype
example: rails generate migration add_password_to_users password:string
Problem Solve Take-note
Get URL parameter path = request.fullpath
path_search = URI.parse(path)
parse_url = CGI.parse(path_search.query)
array_facility_choose = parse_url['search[facilities][]']#params['search']['facilities']
name_facility = Array.new # content all name of facility choose
search[prefecture]=&search[departments][]=3&search[facilities][]=2
To create a model
that references
another, use the
rails model
generator:
$ rails g model wheel car:references
class Wheel < ActiveRecord::Base
belongs_to :car
end
class CreateWheels < ActiveRecord::Migration
def self.up
create_table :wheels do |t|
t.references :car
t.timestamps
end
end
ActiveRecord Products.connection.execute('UPDATE `products` SET `price`=`free` WHERE 1') If the helpers not enough
Rename column script/generate migration rename_my_column_by_hand
Then edit the file it creates:
class RenameMyColumnByHand <
ActiveRecord::Migration
def self.up
rename_column :my_table, :old_name, :new_name
end
def self.down
rename_column :my_table, :new_name, :old_name
end
end
It executes SQL like:
ALTER TABLE my_table CHANGE old_name new_name
BIGINT;
Change type of
column
class AddColumnToTable < ActiveRecord::Migration
def change
add_column :table, :column, :type
end
end
Rails g migration changetypecolumn
Add column rails generate migration add_password_to_users password:string rails generate migration add_columnname_to_tablename
columnname:datatype

More Related Content

PPTX
Introducing asp.net core mvc web application
Joy Sarker
 
DOC
File uploading through paperclip in rails 3.x
Andolasoft Inc
 
PDF
GAB 2019 - Integrate Microsoft Graph​ with Azure Active Directory​ in your cl...
Firas Mdimagh
 
PPTX
Onboarding ibos
Emily Bauman
 
PPTX
Asp introduction
Sireesh K
 
PDF
Component-based Front-End architecture
Artyom Trityak
 
PPTX
Angular introduction basic
jagriti srivastava
 
PDF
M6 l8-ajax-handout
Nolboo Kim
 
Introducing asp.net core mvc web application
Joy Sarker
 
File uploading through paperclip in rails 3.x
Andolasoft Inc
 
GAB 2019 - Integrate Microsoft Graph​ with Azure Active Directory​ in your cl...
Firas Mdimagh
 
Onboarding ibos
Emily Bauman
 
Asp introduction
Sireesh K
 
Component-based Front-End architecture
Artyom Trityak
 
Angular introduction basic
jagriti srivastava
 
M6 l8-ajax-handout
Nolboo Kim
 

Viewers also liked (6)

PDF
Example Mobile Push Notification Service in Rails
Mo Omer
 
PDF
My rails way
wildjcrt
 
PDF
Rails 4 & server sent events
Piotr Karbownik
 
PPTX
Action cable
Colin Rubbert
 
PDF
REST is not enough: Using Push Notifications to better support your mobile cl...
Juan Gomez
 
PDF
Mobile Push Notifications
Mike Willbanks
 
Example Mobile Push Notification Service in Rails
Mo Omer
 
My rails way
wildjcrt
 
Rails 4 & server sent events
Piotr Karbownik
 
Action cable
Colin Rubbert
 
REST is not enough: Using Push Notifications to better support your mobile cl...
Juan Gomez
 
Mobile Push Notifications
Mike Willbanks
 
Ad

Similar to Rails notification (20)

PPTX
12 Introduction to Rails
Deepak Hagadur Bheemaraju
 
DOCX
Ruby on Rails
Sadakathullah Appa College
 
PPT
Ruby On Rails
Gautam Rege
 
PDF
Ruby on Rails - Introduction
Vagmi Mudumbai
 
PDF
Introduction to Rails by Evgeniy Hinyuk
Pivorak MeetUp
 
PDF
Lecture #5 Introduction to rails
Evgeniy Hinyuk
 
PDF
td_mxc_rubyrails_shin
tutorialsruby
 
PDF
td_mxc_rubyrails_shin
tutorialsruby
 
PPT
Ruby on rails
chamomilla
 
PDF
Introduction to Ruby on Rails
Agnieszka Figiel
 
PDF
Rails - getting started
True North
 
PDF
Flexiblerails
reynolds
 
PDF
RubyEnRails2007 - Dr Nic Williams - Keynote
Dr Nic Williams
 
DOC
Rails interview questions
Durgesh Tripathi
 
PDF
Ruby Rails Web Development
Sonia Simi
 
PDF
Ruby On Rails
Balint Erdi
 
PDF
Curso rails
Icalia Labs
 
KEY
Supa fast Ruby + Rails
Jean-Baptiste Feldis
 
PPT
Introduction To Ruby On Rails
Steve Keener
 
PPTX
Learning to code for startup mvp session 3
Henry S
 
12 Introduction to Rails
Deepak Hagadur Bheemaraju
 
Ruby On Rails
Gautam Rege
 
Ruby on Rails - Introduction
Vagmi Mudumbai
 
Introduction to Rails by Evgeniy Hinyuk
Pivorak MeetUp
 
Lecture #5 Introduction to rails
Evgeniy Hinyuk
 
td_mxc_rubyrails_shin
tutorialsruby
 
td_mxc_rubyrails_shin
tutorialsruby
 
Ruby on rails
chamomilla
 
Introduction to Ruby on Rails
Agnieszka Figiel
 
Rails - getting started
True North
 
Flexiblerails
reynolds
 
RubyEnRails2007 - Dr Nic Williams - Keynote
Dr Nic Williams
 
Rails interview questions
Durgesh Tripathi
 
Ruby Rails Web Development
Sonia Simi
 
Ruby On Rails
Balint Erdi
 
Curso rails
Icalia Labs
 
Supa fast Ruby + Rails
Jean-Baptiste Feldis
 
Introduction To Ruby On Rails
Steve Keener
 
Learning to code for startup mvp session 3
Henry S
 
Ad

More from baran19901990 (20)

PDF
Config websocket on apache
baran19901990
 
PDF
Nhập môn công tác kỹ sư
baran19901990
 
PDF
Tìm đường đi xe buýt trong TPHCM bằng Google Map
baran19901990
 
PDF
How to build a news website use CMS wordpress
baran19901990
 
PDF
How to install nginx vs unicorn
baran19901990
 
PDF
Untitled Presentation
baran19901990
 
PDF
Control structure
baran19901990
 
PDF
Subprogram
baran19901990
 
PDF
Lexical
baran19901990
 
PDF
Introduction
baran19901990
 
PDF
Datatype
baran19901990
 
PDF
10 logic+programming+with+prolog
baran19901990
 
PDF
09 implementing+subprograms
baran19901990
 
PDF
08 subprograms
baran19901990
 
PDF
07 control+structures
baran19901990
 
PDF
How to install git on ubuntu
baran19901990
 
DOC
Ruby notification
baran19901990
 
DOC
Linux notification
baran19901990
 
PDF
Lab4
baran19901990
 
PDF
Lab5
baran19901990
 
Config websocket on apache
baran19901990
 
Nhập môn công tác kỹ sư
baran19901990
 
Tìm đường đi xe buýt trong TPHCM bằng Google Map
baran19901990
 
How to build a news website use CMS wordpress
baran19901990
 
How to install nginx vs unicorn
baran19901990
 
Untitled Presentation
baran19901990
 
Control structure
baran19901990
 
Subprogram
baran19901990
 
Lexical
baran19901990
 
Introduction
baran19901990
 
Datatype
baran19901990
 
10 logic+programming+with+prolog
baran19901990
 
09 implementing+subprograms
baran19901990
 
08 subprograms
baran19901990
 
07 control+structures
baran19901990
 
How to install git on ubuntu
baran19901990
 
Ruby notification
baran19901990
 
Linux notification
baran19901990
 

Recently uploaded (20)

PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PDF
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PPTX
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PDF
Advances in Ultra High Voltage (UHV) Transmission and Distribution Systems.pdf
Nabajyoti Banik
 
PDF
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
PDF
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
Advances in Ultra High Voltage (UHV) Transmission and Distribution Systems.pdf
Nabajyoti Banik
 
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 

Rails notification

  • 1. Architecture Rails: Controllers: Rails look to find controllers classes. A controllers handles a web request from user. Views: Holds the display templates to fill in with data from our application, convert to HTML, and return to the user's browser. Models: Holds the classes that model and wrap the data stored in our application's database. Helpers: Holds any helper classes used to assist the model, view, and controllers classes Methods: link_to → creates a hyperlink to an action example: <%= link_to "Hello", say_hello_path %> Marshaling Objects: Take an object and convert it into a stream of bytes that can be stored outside the app. rails generate migration add_columnname_to_tablename columnname:datatype example: rails generate migration add_password_to_users password:string Problem Solve Take-note Get URL parameter path = request.fullpath path_search = URI.parse(path) parse_url = CGI.parse(path_search.query) array_facility_choose = parse_url['search[facilities][]']#params['search']['facilities'] name_facility = Array.new # content all name of facility choose search[prefecture]=&search[departments][]=3&search[facilities][]=2 To create a model that references another, use the rails model generator: $ rails g model wheel car:references class Wheel < ActiveRecord::Base belongs_to :car end class CreateWheels < ActiveRecord::Migration
  • 2. def self.up create_table :wheels do |t| t.references :car t.timestamps end end ActiveRecord Products.connection.execute('UPDATE `products` SET `price`=`free` WHERE 1') If the helpers not enough Rename column script/generate migration rename_my_column_by_hand Then edit the file it creates: class RenameMyColumnByHand < ActiveRecord::Migration def self.up rename_column :my_table, :old_name, :new_name end def self.down rename_column :my_table, :new_name, :old_name end end It executes SQL like: ALTER TABLE my_table CHANGE old_name new_name BIGINT; Change type of column class AddColumnToTable < ActiveRecord::Migration def change add_column :table, :column, :type end end Rails g migration changetypecolumn Add column rails generate migration add_password_to_users password:string rails generate migration add_columnname_to_tablename