Module: ActionControllerMixin

Defined in:
lib/scaffold_logic.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



187
188
189
# File 'lib/scaffold_logic.rb', line 187

def self.included base
  base.extend ClassMethods
end

Instance Method Details

#add_breadcrumb(name, url = '') ⇒ Object

Instance methods ===============================================================================



200
201
202
203
204
# File 'lib/scaffold_logic.rb', line 200

def add_breadcrumb name, url = ''
  @breadcrumbs ||= []
  url = eval(url) if url =~ /_path|_url|@/
  @breadcrumbs << [name, url]
end

#handle_date_time(params, model, attr) ⇒ Object



206
207
208
209
210
211
212
213
214
215
216
# File 'lib/scaffold_logic.rb', line 206

def handle_date_time params, model, attr
  if params && params[model] && params[model]["#{attr}(1i)"]
    year = params[model]["#{attr}(1i)"]
    month = params[model]["#{attr}(2i)"]
    day = params[model]["#{attr}(3i)"]
    params[model][attr] = Date.parse("#{month}/#{day}/#{year}")
    params[model].delete("#{attr}(1i)")
    params[model].delete("#{attr}(2i)")
    params[model].delete("#{attr}(3i)")
  end
end