app/helpers/base.rb
# Used to ensure that certain request parameters are present. Acts like a
# precondition / assertion for your route.
#
# @example
#   # POST with data like user[fname]=John&user[lname]=Doe
#   on "signup", param("user") do |atts|
#     User.create(atts)
#   end
Used to ensure that certain request parameters are present. Acts like a
precondition / assertion for your route.
Used to ensure that certain request parameters are present . Acts like a precondition / assertion for your route .
def param(key, block = false)
    if block
      lambda { captures << req[key] unless req[key].to_s.empty? }
    else
      lambda { captures << req[key] } 
    end
  end
def param ( key , block = false ) if block lambda { captures << req [ key ] unless req [ key ] . to_s . empty? } else lambda { captures << req [ key ] } end end
Used to ensure that certain request parameters are present.
Used to ensure that certain request parameters are present .
# change to empty params
key
<not_specific>
block
<not_specific>
example
POST with data like user[fname]=John&user[lname]=Doe on "signup", param("user") do |atts| User.create(atts) end
POST with data like user [ fname ] = John&user [ lname ] = Doe on " signup " param ( " user " ) do |atts| User . create ( atts ) end