I recommend using Postgres for full text search to start off, and then you can always switch to something like Elastic Search later if you need to. It is just so convenient to keep the full text search in SQL.
Thank you for letting me know about this issue. Which browser are you using? Also try right-clicking the video and switching between HTML 5 and Flash, does that change it?
Thanks for the tip. One side effect of this approach is that you will not be able to weight certain columns AFAIK. Unless maybe you repeat them when building the tsvector?
Thanks for another great episode. I'm new to Rails, and I'm learning alot from RailsCasts.
This episode gets deeper in the weeds than I've ever gone with a database. I'm not familiar with such SQL commands as tsvector. Any suggestions as to a good book or online tutorial to help me get up to speed?
You may run into problems if you combine Texticle with eager loading (as I have done). Depending on your particular queries, you could end up with an error like this:
PG::Error: ERROR: column "rank0.46200151534283984" does not exist
LINE 1: SELECT DISTINCT "medical_people".id, "rank0.462001515342839...
Good one. Under what circumstances would you recommend this over elastic search? The obvious benefit is that you don't need to install and keep up another piece of software just for indexing your content, but I'm concerned about the speed. Have anyone done a speed test between these two search systems? For example, could this handle searching data for a site like pinterest? To think of it, one could start using this and add elastic search later...but any suggestions? Thanks-
Because for local development we're using the unix username to connect to postgres, rbates in your case, you can simply ommit both username and password from database.yml. The underlying library will default to that user name. That way other developers working on the same project can use the same database.yml.
When you specified the postgres URL for taps, you could've also taken advantage of the fact that it's using the default username and host to connect to postgres. The URL can therefore be merely: postgres:///store_development.
Finally, check out valkyrie, the likely successor of taps.
hello Nelson,
I'm trying to run private_pub on heroku.
for test purpose I tryed to run private_pub.ru on a distant server.
But my app won't connect (connection refused) regardless of my private_pub.yml file.
[it seems that on both server (app and private_pub) I can put anything as a server i does not affect the result]
Even with server: http//dumpexample.com:9292/faye on my yml. If i run private_pub.ru on local (same server as app) and it works.
They must be something i don't get on the way private_pub is working.
please could you give me you private_pub.yml on both site (app and private_pub)
Not so much as Ryan seeded his database a thousand times... so there will be multiple instances of the articles he has, so probably a hundred or so "Batman" articles...
This is because right now you need tens of things, so it is not hard to match one of them. If today Ryan released another topic, probably you would tell the same. :) No mystics.
I am having exact problem
when debugged i found out that this might be because when we try to save using active resource xml request
in params: _method=> "put" was not there.
not able to solve this yet..
will appreciate any help
I want to set the locale by the clients browserlocale request.env['HTTP_ACCEPT_LANGUAGE'] and by the url.
If the url has no params[:locale] it should use the browserlocale set the url.
Here is my code:
application_controller.rb
classApplicationController < ActionController::Base
protect_from_forgery
before_filter :set_locale
private
# set the languagedefset_localeif params[:locale].blank?
I18n.locale = extract_locale_from_accept_language_header
elseI18n.locale = params[:locale]
endend# pass in language as a default url parameterdefdefault_url_options(options = {})
{locale:I18n.locale}
end# extract the language from the clients browserdefextract_locale_from_accept_language_header
browser_locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first
ifI18n.available_locales.include? browser_locale
browser_locale
elseI18n.default_locale
endendend
routes.rb
Myapp::Application.routes.draw do# set language path
scope ":locale", locale:/#{I18n.available_locales.join("|")}/do
root :to => "mycontrollers#new"# set RESTful routes for the locations Controller
resources :mycontrollersend
match '*path', to: redirect("/#{I18n.locale}/%{path}"), constraints: lambda { |req| !req.path.starts_with? "/#{I18n.default_locale}/" }
match '', to: redirect("/#{I18n.locale}")
end
The Problem is that the routesfile gets executed first so the controller-actions won't grab anymore.
In the screencast, when Ryan types "psql --version", it's listed as postgres (PostgreSQL) 9.1.3. And "which psql" also returns "/usr/local/bin/psql" for Ryan.
I'm just confused and I'm not sure what to do, if anything.
Great to see this article, PostgreSQL is by far the best choice in many ways, if you want to create an application with accounts that might not have relation (like basecamp) you can create multitenant databases with the schema feature from PostgeSQL. I Have used it with bonsaierp.com
Taps looks interesting, but complicated. The yaml_db gem looks like a simple way to backup and restore data. Does anyone have any experience using yaml_db to migrate from sqlite to PG?
+1. Yes this breaks deployment from Mac to a non-Mac platform. I just leave off the OS-specific line, since I'm deploying to production, and the gem is only used for dev/test on my Mac.
I have the same problem on OSX 10.5.8. Maybe it breaks on the older OSX? Guess I'll try to upgrade at some point... It breaks for me with or without growl/growlnotify.
Any idea on how to have the pianos available to other pages, specifically the home page? The examples on the Refinery site for their engines are a little hard to follow.
@blackpond: Homebrew by design requires that in your user profile file (i.e. .bashrc or .profile or .bash_profile), that your set /usr/local/bin ahead of /usr/bin to avoid clashes with system software tools that may exist in other paths on your machine. it is important that you override the system paths to use homebrew installations as default.
The following post describes a solution for image uploading using CarrierWave while image transformations are done seamlessly in the cloud. Uploaded images are stored in the cloud and delivered through a CDN.
No need to install RMagick, MiniMagick and ImageMagick.
Not sure if this is only happening to me, but it appeared to clip the end by maybe only a few seconds. I don't think anything substantive was cut, just a heads-up
I recommend using Postgres for full text search to start off, and then you can always switch to something like Elastic Search later if you need to. It is just so convenient to keep the full text search in SQL.
Yes, I hope to cover Facebook and Twitter integration in future episodes.
Thank you for letting me know about this issue. Which browser are you using? Also try right-clicking the video and switching between HTML 5 and Flash, does that change it?
It seems to be working okay here in Safari.
Thanks for the tip. One side effect of this approach is that you will not be able to weight certain columns AFAIK. Unless maybe you repeat them when building the tsvector?
Thank you for the tips. Very useful information. I had not heard of Valkyrie before but looks more convenient than Taps.
Just an FYI, I had to add Rake as a dependency in my
.gemspec
file. I was using Bundler 1.1.3 when I worked through this episode.BTW, the problem I noted above does not afflict me if I use
pg_search
(so, thanks for the alternative, Ryan).Thanks for another great episode. I'm new to Rails, and I'm learning alot from RailsCasts.
This episode gets deeper in the weeds than I've ever gone with a database. I'm not familiar with such SQL commands as tsvector. Any suggestions as to a good book or online tutorial to help me get up to speed?
You may run into problems if you combine Texticle with eager loading (as I have done). Depending on your particular queries, you could end up with an error like this:
The gory details (sans a simple solution) are here https://github.com/tenderlove/texticle/issues/71, here https://github.com/Casecommons/pg_search/issues/14, and here https://github.com/rails/rails/issues/950
Good one. Under what circumstances would you recommend this over elastic search? The obvious benefit is that you don't need to install and keep up another piece of software just for indexing your content, but I'm concerned about the speed. Have anyone done a speed test between these two search systems? For example, could this handle searching data for a site like pinterest? To think of it, one could start using this and add elastic search later...but any suggestions? Thanks-
Really glad to see postgres covered here!
A couple of tips:
rbates
in your case, you can simply ommit bothusername
andpassword
from database.yml. The underlying library will default to that user name. That way other developers working on the same project can use the same database.yml.postgres:///store_development
.Finally, check out valkyrie, the likely successor of taps.
Thanks!
hello Nelson,
I'm trying to run private_pub on heroku.
for test purpose I tryed to run private_pub.ru on a distant server.
But my app won't connect (connection refused) regardless of my private_pub.yml file.
[it seems that on both server (app and private_pub) I can put anything as a server i does not affect the result]
Even with server: http//dumpexample.com:9292/faye on my yml. If i run private_pub.ru on local (same server as app) and it works.
They must be something i don't get on the way private_pub is working.
please could you give me you private_pub.yml on both site (app and private_pub)
Thanks a lot
Im seeing a similar problem using RBEnv. Can't get past it. Any tips?
Hi! thank you for the tutorial, very helpfull.
i've a question
which is the difference between this two sintax
Entry.create!(name: "Aaron Patterson")
and
Entry.create(:name => "Aaron Patterson")
beacause the first generates an error at command rake db:seed
Yes - this happened to me too. It is also happening on older railscasts. I think that may important in solving this little issue. :)
Ah! Thanks for explaining that, that's pretty clear to me now.
@heyitsmeross: See my earlier comments @blackpond. It's just a path problem.
You can change this in your .bashrc / .bash_profile / .zshrc or do as I've done and change it where it originates, in /etc/paths.
Homebrew's main repository doesn't usually include packages that have already been installed, so the path won't have been an issue for you until now.
Not so much as Ryan seeded his database a thousand times... so there will be multiple instances of the articles he has, so probably a hundred or so "Batman" articles...
Same here
At the end search gives 3 same articles named "Batman", a bit strange.
This is because right now you need tens of things, so it is not hard to match one of them. If today Ryan released another topic, probably you would tell the same. :) No mystics.
+1
Enrico,
How did you set twitter's column classes (like .span8) to refinery's page sections (body and side_body)?
I've gotten to the same point in your layouts/application file, but am hitting a roadblock when trying to style the inner page section.
thanks for the help
if you dont want to use the psql cli, you can try pgAdmin.
http://www.pgadmin.org/
I am having exact problem
when debugged i found out that this might be because when we try to save using active resource xml request
in params: _method=> "put" was not there.
not able to solve this yet..
will appreciate any help
I want to set the locale by the clients browserlocale
request.env['HTTP_ACCEPT_LANGUAGE']
and by the url.If the url has no
params[:locale]
it should use the browserlocale set the url.Here is my code:
The Problem is that the routesfile gets executed first so the controller-actions won't grab anymore.
Does anyone has a solution for that?
Thank you Ryan. This is really amazing. PostgreSQL and Pg_search are life-saving for more web applications.
+1
I like the taps gem :) Thank you Ryan.
This is insane. No more MySQL for me!
I followed the instructions for upgrading PostgreSQL on a new install of OS X Lion by typing "brew install postgresql."
But I think I am having a problem:
"psql --version" returns psql (PostgreSQL) 9.0.5
"which psql" returns /usr/bin/psql
"postgres --version" returns postgres (PostgreSQL) 9.1.3
/usr/local/bin/postgres
In the screencast, when Ryan types "psql --version", it's listed as postgres (PostgreSQL) 9.1.3. And "which psql" also returns "/usr/local/bin/psql" for Ryan.
I'm just confused and I'm not sure what to do, if anything.
Great to see this article, PostgreSQL is by far the best choice in many ways, if you want to create an application with accounts that might not have relation (like basecamp) you can create multitenant databases with the schema feature from PostgeSQL. I Have used it with bonsaierp.com
Taps looks interesting, but complicated. The yaml_db gem looks like a simple way to backup and restore data. Does anyone have any experience using yaml_db to migrate from sqlite to PG?
+1. Yes this breaks deployment from Mac to a non-Mac platform. I just leave off the OS-specific line, since I'm deploying to production, and the gem is only used for dev/test on my Mac.
I have the same problem on OSX 10.5.8. Maybe it breaks on the older OSX? Guess I'll try to upgrade at some point... It breaks for me with or without growl/growlnotify.
Excellent. Ryan, i have notice you havent touched integrating rails with social networks, any hopes for seen that in a future episode?
Can't play on ipad :/
Any idea on how to have the pianos available to other pages, specifically the home page? The examples on the Refinery site for their engines are a little hard to follow.
@blackpond: Homebrew by design requires that in your user profile file (i.e. .bashrc or .profile or .bash_profile), that your set /usr/local/bin ahead of /usr/bin to avoid clashes with system software tools that may exist in other paths on your machine. it is important that you override the system paths to use homebrew installations as default.
Thanks!
Love the screencast, thanks for mentioning my hstore article :)
small correction, @14:42 you actually mean 5ms not 5s
P.S. If you have already installed the postgres gem, uninstall it and then re-install it.
@blackpond: Edit /etc/paths and make sure /usr/local/bin is above /usr/bin in the file. Open a new shell, and you're good to go!
Long been a PostgreSQL fan so great to see this being covered.
@anyone: taps is great, but don't rely on the record count, it stops working when you have more than 400 records
It is because the script is using it's own sudo command:
https://github.com/fesplugas/rbenv-installer/blob/master/bin/rbenv-bootstrap-ubuntu-11-10
Capistrano has its own sudo helper which types in the password for you. Normally you can't pass input directly.
I just copied rbenv's bootstrap file and made it into one line so I can bootstrap myself.
The following post describes a solution for image uploading using CarrierWave while image transformations are done seamlessly in the cloud. Uploaded images are stored in the cloud and delivered through a CDN.
No need to install RMagick, MiniMagick and ImageMagick.
http://cloudinary.com/blog/ruby_on_rails_image_uploads_with_carrierwave_and_cloudinary
Thanks for another informative screencast.
Not sure if this is only happening to me, but it appeared to clip the end by maybe only a few seconds. I don't think anything substantive was cut, just a heads-up
You might have to brew link it.
This is AWESOME! My only problem is I installed via homebrew on Lion and when I do which psql I get:
/usr/bin/psql
How can I point it to the homebrew version?
you shouldn't need pg_restore
psql has a -f switch that takes a file as an argument