Skip to content

Instantly share code, notes, and snippets.

View JonathanVeg's full-sized avatar

Jonathan Silva JonathanVeg

View GitHub Profile
@JonathanVeg
JonathanVeg / gist:5428189
Created April 21, 2013 02:14
Meu formulário, onde o file_field somente me retorna uma simples String. Eu já tentei com form_tag normal e tive o mesmo resultado. Eu preciso do object do upload pra poder passar pro meu paperclip do usuário.
%form{:id=>'form', :method=>"post"}
= form_for @user do |f|
=text_field_tag "name", params[:name], :placeholder => "Nome"
%br
=text_field_tag "email", params[:email], :placeholder => "E-mail"
%br
=text_field_tag "username", params[:username], :placeholder => "Nome de usuário"
%br
=password_field_tag "password", params[:password], :placeholder => "Senha"
%br
= form_for @user2 do |f|
- if @user2.errors.any?
#error_explanation
%h2= "#{pluralize(@user2.errors.count, "error")} prohibited this user2 from being saved:"
%ul
- @user2.errors.full_messages.each do |msg|
%li= msg
.field
= f.label :nome
<html>
<head></head>
<title>Responde Aí</title>
<link href="/assets/application.css?body=1" media="all" rel="stylesheet" type="text/css" />
<script src="/assets/application.js?body=1" type="text/javascript"></script>
<meta content="authenticity_token" name="csrf-param" />
<meta content="NM2lGRh/Fm0pP+5l4b6HAdw2IFWBhbPGtrvQyR3bgLM=" name="csrf-token" />
<script src="/assets/user/cadaster.js?body=1" type="text/javascript"></script>
</html>
=form_tag('/user/cadaster', :multipart => true) do
=text_field_tag "name", params[:name], :placeholder => "Nome"
%br
=text_field_tag "email", params[:email], :placeholder => "E-mail"
%br
=text_field_tag "username", params[:username], :placeholder => "Nome de usuário"
%br
=password_field_tag "password", params[:password], :placeholder => "Senha"
%br
=password_field_tag "password_confirm", params[:password_confirm], :placeholder => "Confirme sua senha"
# MODEL
class Step < ActiveRecord::Base
belongs_to :book
belongs_to :charpter
belongs_to :exercice
attr_accessible :image, :body, :number, :book, :charpter, :exercice
has_attached_file :image
end
{
"error": {
"message": "Invalid redirect_uri: A URL informada não é permitida pela configuração do aplicativo.",
"type": "OAuthException",
"code": 191
}
}
#block-books
#sectionDisciplines0.sectionDisciplines
- @books.each do |b|
.book-item
- if b.matter_id == @ids[0]
%a{:href => ""}
= image_tag b.avatar.url
%a.title-item-book{:href => ""}
%p
= b.name
$(".like").click(function() {
var exercice = $("#exercice-select").val();
var evaluationPro = $('#vote-answer .like p');
var evaluationCon = $('#vote-answer .dislike p');
$.get("/user/home?like='" + exercice + "'", function(json){
alert(json);
evaluationPro.html(json[0]);
evaluationCon.html(json[1]);
});
#include <stdio.h>
#include <stdarg.h>
void print(int i){
printf("%d ", i);
}
void println(int i){
printf("%d\n", i);
}
.field
%select{:name => 'category', :multiple => true}
%option{:value => "0"}
= "Categoria"
- @categories.each do |c|
%option{:value => "#{c.id}"}
= c.name