Skip to content

Instantly share code, notes, and snippets.

View ch1ago's full-sized avatar
🏠
Working mostly from home since 2006

Thiago Almeida ch1ago

🏠
Working mostly from home since 2006
  • Mexico City
  • 11:21 (UTC -06:00)
View GitHub Profile
NoMethodError in Devise::RegistrationsController#new
undefined method `new_with_session' for #<Class:0xb2b59fc>
Rails.root: /home/usuario/apps/ex2
Application Trace | Framework Trace | Full Trace
app/controllers/devise/registrations_controller.rb:71:in `build_resource'
app/controllers/devise/registrations_controller.rb:8:in `new'
module UserModuleKeyValueStore
def self.included(base)
base.extend ClassMethods
base.class_eval do
after_save :kv_save
end
end
module ClassMethods
class ApplicationController < ActionController::Base
protect_from_forgery
helper_method :is_manager?, :current_cart, :cc
protected
def current_cart
@current_cart ||= session[:cart_key] ? Cart.where(w).first : Cart.new
end
Started GET "/h/ajax_notifications?time=1315099321571" for 127.0.0.1 at 2011-09-03 22:22:01 -0300
Processing by HomeController#ajax_notifications as HTML
Parameters: {"time"=>"1315099321571"}
User Load (3.7ms) SELECT "users".* FROM "users" WHERE "users"."id" = 3 LIMIT 1
SQL (1.8ms) SELECT COUNT(*) FROM "post_user_news" WHERE "post_user_news"."is_read" = 'f' AND ("post_user_news".user_id = 3)
PostUserNews Load (2.2ms) SELECT post_id, reason_why, reason_trigger, max(user_id_from) as user_id_from, max(created_at) as created_at, count(*) FROM "post_user_news" WHERE ("post_user_news".user_id = 3) AND (post_id IS NOT NULL) GROUP BY post_id, reason_why, reason_trigger ORDER BY created_at DESC LIMIT 6
Exist fragment? views/ajax_news/unread/0/md5/f11abefe3abe360db37213db1fa93b0c (0.3ms)
Read fragment views/ajax_news/unread/0/md5/f11abefe3abe360db37213db1fa93b0c (0.1ms)
Rendered home/ajax_notifications.html.erb (5.0ms)
Completed 200 OK in 644ms (Views: 9.2ms | ActiveRecord: 20.0ms)
sudo apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev
sudo apt-get install sqlite3 libsqlite3-dev libsqlite3-ruby1.9.1
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
if
@sentiment["mood"] == positive && @sentiment["prob"] > 0.94
@tag.score = 100
elsif
@sentiment["mood"] == positive && @sentiment["prob"] > 0.89
@tag.score = 96
elsif
@sentiment["mood"] == positive && @sentiment["prob"] > 0.84
@tag.score = 92
elsif
def consent
@user = current_user
if @user.update_attributes(params[:user])#this is really dangerous, I could force my email to change form the form =/
redirect_to :back, notice: "Error updating your user account"
else
flash[:notice] = 'User information updated'
@cart.consent_updated = false
end
end
<jarr0dsz> im having a @group.participants.order(:id).offset(0).limit(1).first that returns a participant object i checked with .inspect but how do i get an attribute from that?
first_participant = @group.participants.order("id").select("name").first || :no_participant_for_this_group
if first_participant == :no_participant_for_this_group
puts first_participant.name
else
<% module_namespacing do -%>
class <%= controller_class_name %>Controller < ApplicationController
# TODO: name these comments properly with all the matching URLs to each action
# GET <%= route_url %>
def index
@<%= plural_table_name %> = <%= orm_class.all(class_name) %>
end
# GET <%= route_url %>/1
def link_to_profile_dropdown(user)
link_to "#", :class => "dropdown-toggle", "data-toggle" => "dropdown" do
"#{user.email} <b class='caret'></b>"
end
end