This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
helper :all # include all helpers, all the time | |
protect_from_forgery # See ActionController::RequestForgeryProtection for details | |
# Scrub sensitive parameters from your log | |
# filter_parameter_logging :password | |
before_filter :authorize, :except => [[:login],[:resetarsenha]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= form_for (@gallery, :html => {:multipart => true}) do |f| %> | |
<% if @gallery.errors.any? %> | |
<div id="error_explanation"> | |
<h2><%= pluralize(@gallery.errors.count, "error") %> prohibited this gallery from being saved:</h2> | |
<ul> | |
<% @gallery.errors.full_messages.each do |msg| %> | |
<li><%= msg %></li> | |
<% end %> | |
</ul> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActionMailer::Base.smtp_settings = { | |
:tls => true, | |
:address => "smtp.gmail.com", | |
:port => 587, | |
:domain => "localhost", | |
:user_name => "user", | |
:password => "***", | |
:authentication => "plain", | |
:enable_starttls_auto => true | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Gallery < ActiveRecord::Base | |
has_many :gallery_photos | |
accepts_nested_attributes_for :gallery_photos | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= form_for (@gallery, :html => {:multipart => true}) do |f| %> | |
<% if @gallery.errors.any? %> | |
<div id="error_explanation"> | |
<h2><%= pluralize(@gallery.errors.count, "error") %> prohibited this gallery from being saved:</h2> | |
<ul> | |
<% @gallery.errors.full_messages.each do |msg| %> | |
<li><%= msg %></li> | |
<% end %> | |
</ul> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SendMail < ActionMailer::Base | |
def contact(nome, fone, email, assunto, corpo) | |
recipients '[email protected]' | |
from "SITE: | |
subject assunto | |
sent_on Time.now | |
content_type "text/html" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GalleriesController < ApplicationController | |
# GET /galleries | |
# GET /galleries.xml | |
def index | |
@galleries = Gallery.all | |
respond_to do |format| | |
format.html # index.html.erb | |
format.xml { render :xml => @galleries } | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GalleriesController < ApplicationController | |
# GET /galleries | |
# GET /galleries.xml | |
def index | |
@galleries = Gallery.all | |
respond_to do |format| | |
format.html # index.html.erb | |
format.xml { render :xml => @galleries } | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_form.html.erb | |
<%= form_for(@gallery) do |f| %> | |
<% if @gallery.errors.any? %> | |
<div id="error_explanation"> | |
<h2><%= pluralize(@gallery.errors.count, "error") %> prohibited this gallery from being saved:</h2> | |
<ul> | |
<% @gallery.errors.full_messages.each do |msg| %> | |
<li><%= msg %></li> | |
<% end %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
before_filter :load_genero | |
def index | |
@livros = Livro.all | |
@livros = @genero.livros | |
respond_to do |format| | |
format.html # index.html.erb | |
format.xml { render :xml => @livros } | |
end |