Skip to content

Instantly share code, notes, and snippets.

View richardsondx's full-sized avatar

Richardson Dackam richardsondx

View GitHub Profile
@richardsondx
richardsondx / gist:1093513
Created July 19, 2011 19:40
Issue with the edit part of the associated post.
def create
@micropost = Micropost.find(params[:micropost_id])
@answer = @micropost.answers.create(params[:answer])
redirect_to micropost_path(@micropost)
end
def edit
@micropost = Micropost.find(params[:micropost_id])
@answer = @micropost.answer.find(params[:id])
@richardsondx
richardsondx / gist:1094033
Created July 19, 2011 23:49
Wasn't able to fix a NoMethodError in Answers#index issue
# I look for solutions for NoMethodError and tried to switch the @answers by @answers
# I tried to redirect the route of answers#index
# The issue happen when I click on "Back" from any page of the answer view, after editing # an "Answer" or when i land on "http://localhost:3000/answers" since the back button
# redirect me toward this page. I thought the issue could be the name of my path but I
# wasn't able to fix it. I am quite confused that @answer is returned as nil when i click # on back
#========================================
# Error message I get from : http://localhost:3000/answers
#========================================
@richardsondx
richardsondx / MYSQL GEM issue
Created July 21, 2011 20:08
Problem while installing mysql
osiris:~ evenix$ sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql
Password:
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/Users/evenix/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb --with-mysql-dir=/usr/local/mysql
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
@richardsondx
richardsondx / gist:1098857
Created July 22, 2011 03:58
Bundle Mysql
Using bundler (1.0.14)
Installing mysql (2.8.1) with native extensions /Users/Richardson/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:551:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/Users/Richardson/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
NoMethodError in Deals#edit
Showing /app/views/deals/_form_edit.html.erb where line #26 raised:
undefined method `merge' for 2011-12-12 07:43:35 -0700:Time
Extracted source (around line #26):
23: </p>
24: <p>
25: <%= f.label :start_time%><br />
This is based on an assignment from http://ruby.learncodethehardway.org/book/ex48.html
it seem that the test fail once it tries to scan more than one words,
since 'result' return only one pair and does not match the expected result
@richardsondx
richardsondx / Controller
Created February 26, 2012 06:48
Assign a value to a param, from 2 choices.
def new
@micropost = Micropost.new(:tag => '4' )
# Change the value of 'Micropost.find(..).to_guys' to True or False depending on what button was pressed
if request.post?
if params[:name].include?( 'to_guys' )
@micropost.to_guys = true
flash[:notice] = 'This post was sent to guys'
else
What I am trying to do is: while I am using paginate and navigating through the pages, I want the user to be able to click on a micropost.content and be redirected to the micropost 'display' view as I am using the show view for the admin side.
@richardsondx
richardsondx / View index.html.erb
Created March 12, 2012 14:56
When I try to submit the form from the _form2 view,the content of the file is empty as if the program didn't recognize the ":commit => "to girls"
<span id="containerright">
<div class="logo"><%= image_tag("home_logo.png")%></div>
<% @micropost = Micropost.new %>
<%= render :partial => 'microposts/form2', :locals => { :micropost => @micropost } %>
</div>
</span>
@richardsondx
richardsondx / application view
Created March 30, 2012 00:03
I'm unable to make jquery work locally
<!DOCTYPE html>
<html>
<head>
<title>Gigiki</title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>