RailsCasts Pro episodes are now free!

Learn more or hide this

Denis's Profile

GitHub User: grammakov

Comments by Denis

Avatar

add this line to your config

openssl_verify_mode: 'none'

Avatar

let(:comment) { FactoryGirl.create(:comment, user: user, commentable: question) }

subject { comment }

it { should respond_to(:commentable) }

Avatar

yup it is
use scope :name, ->{stuff}

Avatar

its 2013 and this screencast is still actual

Avatar

Ryan. On behalf of all beginners I am begging you PLEASE stop using Coffeescript. It is hard enough that we have rush to master several techniques simultaneously, people keep overcomplicating stuff which is already hard enough with things like Coffee. Please!!!

Avatar

Please explain how is that the best practice

Avatar

If you're having problems with some jQueries you can try the jQuery-Turbolinks gem: https://github.com/kossnocorp/jquery.turbolinks/

Avatar

'YAY THAT WORKS' - loving it! :)

Avatar

Thanks!
Altho you forgot an underscore on your first line

Avatar

Place this in the Gemfile:

gem 'best_in_place', github: 'bernat/best_in_place'

Avatar

If you are having Error with default thumbnails (the nil error) consider this code:

def filename
super.chomp(File.extname(super)) + '.png' unless super.nil?
end

Avatar

Hello from 2013!

For rails 4 I am using the following code:

PostController:

def index
if params[:search]
@posts = Post.search(params[:search]).order("created_at DESC")
else

@posts = Post.all.order('created_at DESC')
end
end

Post model

def self.search(query)
# where(:title, query) -> This would return an exact match of the query
where("title like ?", "%#{query}%")
end

Index view:

<%= form_tag(posts_path, :method => "get", id: "search-form") do %>
<%= text_field_tag :search, params[:search], placeholder: "Search Posts" %>
<%= submit_tag "Search" %>
<% end %>

Good luck!