error message: ActiveModel::MassAssignmentSecurity::Error in OrdersController#create

ActiveModel::MassAssignmentSecurity::Error in OrdersController#create

Can’t mass-assign protected attributes: name, address, email
I’m trying and use a book -> Pragmatic Agile Web Development with Rails 4th Edition.

edit the order model app/models/order.rb

class Order < ActiveRecord::Base
has_many :line_items, dependent: :destroy	
attr_accessible :name, :address, :email, :pay_type


adding :name, :address, :email to the attr_accessible line in the order model


css github buttons

CSS3 github buttons is awesome button style, this is similar button in, helps you easily create GitHub-style buttons from links, buttons, and inputs. this article is example for use github style button as written in rails code
for example:

<a class="button" href="#">Get Started</a>


<%=  button_to 'Add to Cart', line_items_path(product_id: product), :class => "button big" %>
<%= f.submit "Create Product", :class => "button big"%>

id-ruby on unas

ID-ruby on Unas

Id-Ruby is a rubyist community in Indonesia. this page for remembering both id-ruby and Universitas Nasional (unas). before, September 2009 (Ramadhan month). Id-ruby and community of MySql Indonesia on Universitas Nasional.

Id-Ruby visiting to universitas nasional in order to introducing ruby code, ruby on rails.


teknik informatika unas

Speakers :

  1. Arie Kusuma Atmaja
  2. Michael Smith
  3. and so on

Place :

Aula- Sutan Takdir Alisyahbana Mosque


About ID-ruby


id-ruby is a community of ruby users based in Indonesia. We’re a friendly group that freely shares knowledge about the Ruby programming language, its libraries and frameworks, such as Ruby on Rails. The group meets at least once a month for talks, demos, hacks and discussions. Meetings are free and open to the public. Developers with any level of Ruby experience or any programming languages background are welcomed to participate.

Getting in touch

Join us in our mailing lists, and come see us in our meetups!

homepage :

Getting involved

Fork our repository here and send us your best pull request to contribute

Action Mailer


Actiion Mailer Tutorial on Rails 3

Action Mailer has been rewrite in Rails 3 , I assuming that you have the User model, and then I’ll generate a new mailer with the following code

   rails g mailer user_mailer


class UserMailer < ActionMailer::Base
default :from => ""

  def registration_confirmation(user)
    @user = user
    mail(:to =>, :subject => "Registered")


ctionMailer::Base.smtp_settings = {
 :address              => "",
:port                 => "587",
 :domain               => "",
 :user_name            => "",
  :password             => "secret",
  :authentication       => "plain",
 :enable_starttls_auto => true

 ActionMailer::Base.default_url_options[:host] = "localhost:3000"


Thank you for registering!
<%= %>

Sincerely for you


def create
      @user =[:user])
        sign_in @user
        flash[:success] = "Welcome to the Masmet App!"
        redirect_to @user

        @title ="sign up"
        render 'new'


REST in rails

Rails introduced support for designing APIs consistent with the REST style. Representational State Transfer (REST) is complex topic in Information theory. Basically, you start with the general proposition of machines that can talk to each other, and you start ruling some practice in and others out by imposing constraints that include:

  • Use of a client-server architecture
  • Stateless communication
  • Expicit signaling of response cacheability
  • Use of HTTP request methods such as GET, POST, PUT and DELETE

REST in Rails

the REST support in Rails consists of methods to define resources in the routing system, designed to impose a particular style and order and logic on your controllers and, consequently, on the way the world sees your application.

The story of REST and Rails starts with CRUD

Routing and CRUD

CRUD ( Create Read Update Delete) is the classic summary of the spectrum of database operations. the routing system does not force you to implement your app’s CRUD functionality in any consistent manner.

Here’s the logic. It’s good to give CRUD-based names to your actions. It’s convenient and elegant to use named routes.  The REST support in rails gives you named routes that point to CRUD-based action names. if you put into your config/routes.rb file,n you will have created for named routes.

by creating a route like bellow:


  root :to => 'pages#home'
  match '/about', :to => 'pages#about'
  match '/contact', :to => 'pages#contact'

what’s the meaning?

This code maps the root URL / to /pages/home, and also gives URL helpers as follows:
root_path => ‘/’
root_url => ‘http://localhost:3000/&#8217;

Named route

<%= link_to "Home", root_path %>
<%= link_to "About", about_path %>