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!!!
oh man thanx so much for this
add this line to your config
openssl_verify_mode: 'none'
let(:comment) { FactoryGirl.create(:comment, user: user, commentable: question) }
subject { comment }
it { should respond_to(:commentable) }
Oh i bet he is
yup it is
use scope :name, ->{stuff}
its 2013 and this screencast is still actual
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!!!
Please explain how is that the best practice
If you're having problems with some jQueries you can try the jQuery-Turbolinks gem: https://github.com/kossnocorp/jquery.turbolinks/
'YAY THAT WORKS' - loving it! :)
Thanks!
Altho you forgot an underscore on your first line
Place this in the Gemfile:
gem 'best_in_place', github: 'bernat/best_in_place'
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
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!