I too switched from Thinking Sphinx over to Sunspot, mainly because at the time I was developing an app needing fulltext search, Heroku did not support TS. Please note that Heroku does support TS now.
And no rake tasks existed with the sunspot_mongoid gem, so I used Aaron Qian's version that can be found on Github, and it works sweet.
Anyway Ryan, I hope you can show us a little more sunspot but used with Mongoid...I'm sure you will have a better solution than the one I have just described!
I've been using Sunspot for over a year now and it is very nice, however one thing that seems to be avoided anywhere Sunspot is mentioned is that getting it setup in a production environment can be very tedious. Its actually a real PITA.
Thanks! Did anyone work with solr/thinking sphinx in combination with user-based content?
Example: I want to create a faceted search of boy-scout camping-sites that also has a facets like "places that I visited" and "places that my friends visited". Those facets should work like any other facet
Another alternative for faking Time is Delorean. It's quite similar to Timecop, although it does not offer the freeze capabilities. Check it out, its code is really minimal and beautiful!
How does the distance_from work? Is the distance considering the streets, the same as used on maps.google.com (by walk, by car, by bus and etc) or just straight point to point?
that's pretty much the way a lot of people are doing things now - although I dunno if authentication is something for which I'd use an engine - maybe you would though
if you can afford it, I'd recommend buying and reading "Crafting Rails Applications" by Jose Valim, from where much of rails3.1's updated engine code was extracted (see the enginex gem if you're on older rails)
and here's my favourite engine atm (called rails admin) which handles all your back-end stuff (== no more django-envy): https://github.com/sferik/rails_admin
I cannot seem to get this to work as I would want, and I don't see how to change it... from the examples given, it only allows for 1 question/answer.etc. because the html looks like this:
when it should be like:
in order to get an array in the params when it reaches the server... anyone got a solution for this?
I tried using 'guard-test' with Rails 3.1pre5 and apparently the 'test' isn't rack-test.... is there a rack-test guard so you can use this with the default testing framework for Rails3.1?
Instance variables in models are also lost because each request is basically a blank slate.
The only thing to persist through requests are class variables, however, they too get lost when the server is shut down (or in the case of Phusion Passenger, the worker goes idle and gets removed).
To overcome these issues, use an external caching system. Rails has support for a few, like memcached.
I've just implemented the tagging thing right into my system and built around it - and now I'm realising that I don't have a clue how to search for the tags. Is there any easy way to search (using something similar to the simple searching railscast) both my tutorial names and their tags (in which taggings are done via this tutorial).
My current super simple search code is below:
ruby
find(:all, :conditions => ['name LIKE ?', "%#{search}%"])
Mountable engines was totally new to me before I watched this screencast. Therefor I have a couple of questions..
Would a use case example be to create a authentication and profile engine, then a blog engine, a forum engine etc and combine them all together under a "umbrella" app?
Is the mentioned use case a good way to create better scalable apps?
I guess you can create a engine within a engine as well?
I'm sorry. I'm still a little unclear. I understand that instance variables of a controller are killed on every request. This is because every new request generates a new controller object (is this correct?). However, wouldn't the instance variables in a model last until model.destroy?
Otherwise, how is the lifetime of a model's instance variables defined?
I found that some error while testing with cucumber and fakeweb while you have @javascript tag on cucumber. It time out for some reason. Here is the issue https://github.com/chrisk/fakeweb/issues/25
Hello, I am trying to implement the subdomains on my app. I am using rails 3.1.rc5. The problem is that "constraints" in my route.rb does not work and i am redirected to my app root. However if I use "constraint" (singular), my subdomain is parsed and i am succesfully routed to the show action of the controller i wanted (SchoolsController). The problem with this is that when i do not use a subdomain and therefore wish to be redirected to the root of my app, i get an "ActiveRecord::RecordNotFound" because it cannot find a School with that subdomain.
Strange thing. When i put a job into queue when stalker is running, it repeats the same job over and over again and only stops if the job fails. Someone else with this?
We have found Cucumber to actually slow tests down a bit more than Capybara. You can easily use Cucumber and Capybara hand in hand if you would like.
The benefit would be more human readable cucumber steps which means being able to lay out a complete feature with a client or be able to show a client your feature file and having them be able to grasp what is going on.
I am using JQtouch for creating my application works for mobile.
I am already having an web application,now I just want application works on mobile.
But js files from public/javascript folder and also any js files from pugins not works for mobile app.
Any one having solution for this
??
For some reason my Nearby Locations aren't working. I haven't tried to go past that part. I've tried copy and pasting the code into the right files and it still doesn't work :(. Anyone have an idea as to what would be causing this?
Great screencast! I realy love your "*from scratch" screencasts but i encountered some problems:
I had to use save!(validate: false) in the send_password_reset method after i added some validation on my user model. Why does the validation for the presence of a password and password_confirmation fire on the reset password form? And is there any way to validate only for a valid email withou using javascript?
Another good example of engines is Spree Commerce. The engines are not mountable but you can see how powerful the concept is even without mounting and namespaces (which we plan to support.)
It's because the semantics don't work quite right. Migrations these days are timestamped, so you can roll back and forward in the order the migrations were applied, right? The timestamp is encoded in the migration file name.
If you just use migrations from the engine... they'll be timestamped with the time the developer of the engine created them, not the time your app actually first included/applied them.
The best thing I've found to do is have a generator which generates your engine/gem's migrations directly into the local rails app, with a filename with timestamp based on time-of-generation-into-local-app, and only doing this generation if a migration with the same name (not counting timestamp) does not already exist in local app (so the generation step is idempotent, and can be run for later versions of engine/gem and only add new migrations, not duplicate ones already generated).
Yeah, thanks Ryan, great cast!
I too switched from Thinking Sphinx over to Sunspot, mainly because at the time I was developing an app needing fulltext search, Heroku did not support TS. Please note that Heroku does support TS now.
Also, I used Sunspot with Mongoid, but this required a monkeypatch to have access to variables such as current_page, total_pages, etc...those used in pagination. Here is a link to the approach I took http://techbot.me/2011/01/full-text-search-in-in-rails-with-sunspot-and-solr/.
And no rake tasks existed with the sunspot_mongoid gem, so I used Aaron Qian's version that can be found on Github, and it works sweet.
Anyway Ryan, I hope you can show us a little more sunspot but used with Mongoid...I'm sure you will have a better solution than the one I have just described!
Ditto on this experience. I wish they'd somehow tune the version that comes with the gem so it could be used in production.
For users in Windows precaution:
This didn't work for me argument (0 for 1) was thrown ...
I had to get around the index action like this..
A good idea, if you have the money, is to use Websolr.
Yes. One solution is to add a comment observer that updates the article model when needed.
I've been using Sunspot for over a year now and it is very nice, however one thing that seems to be avoided anywhere Sunspot is mentioned is that getting it setup in a production environment can be very tedious. Its actually a real PITA.
Thanks that was great Ryan
But I got some error when I try to write:
When I try to open the products page its showing the following error:
Any help with this I will be grateful.
@Ryan
Thanks for this episode!
Please add link for thinking_sphinx episode to "Similar Episodes"
Sunspot is greater than sphinx, thanks for this episode! :)
Thanks! Did anyone work with solr/thinking sphinx in combination with user-based content?
Example: I want to create a faceted search of boy-scout camping-sites that also has a facets like "places that I visited" and "places that my friends visited". Those facets should work like any other facet
The auto indexing looks nice/simpler than sphinx. It'll be interesting to see how they compare in production. Thanks Ryan!
Great cast. Think I like this solution better than thinking sphinx. Is it also better?
Thanks, good solution, exactly what I was looking for!
I think I misunderstood one thing:
Will this require reindexing of comments on every comment update?
Good cast Ryan. Any reasons to prefer this over thinking_sphinx?
See this tutorial i think it will help:
http://blog.assimov.net/post/4306595758/multi-file-upload-with-uploadify-and-carrierwave-on
Thanks Ryan!
Another alternative for faking Time is Delorean. It's quite similar to Timecop, although it does not offer the freeze capabilities. Check it out, its code is really minimal and beautiful!
https://github.com/bebanjo/delorean
For rails 3, see the most voted answers here:
http://stackoverflow.com/questions/341143/can-rails-routing-helpers-i-e-mymodel-pathmodel-be-used-in-models
I am using resque-scheduler for scheduling. Is anyone using this? I am getting this error message when I submit to a queue.
(Job{news_scraper_queue} | NewsScraper | []) failed: #
has anyone tried to use scheduling with the workers being in the app/workers directory?
I think that it's straight point to point...
http://rdoc.info/github/alexreisner/geocoder/master/Geocoder/Calculations#distance_between-instance_method
http://en.wikipedia.org/wiki/Haversine_formula
You may try VCR to stub the HTTP response.
http://github.com/myronmarston/vcr
;)
How does the distance_from work? Is the distance considering the streets, the same as used on maps.google.com (by walk, by car, by bus and etc) or just straight point to point?
that's pretty much the way a lot of people are doing things now - although I dunno if authentication is something for which I'd use an engine - maybe you would though
if you can afford it, I'd recommend buying and reading "Crafting Rails Applications" by Jose Valim, from where much of rails3.1's updated engine code was extracted (see the enginex gem if you're on older rails)
ryan bigg posted a link to this nice forum engine he made http://github.com/radar/forem
and here's my favourite engine atm (called rails admin) which handles all your back-end stuff (== no more django-envy): https://github.com/sferik/rails_admin
I cannot seem to get this to work as I would want, and I don't see how to change it... from the examples given, it only allows for 1 question/answer.etc. because the html looks like this:
when it should be like:
in order to get an array in the params when it reaches the server... anyone got a solution for this?
I tried using 'guard-test' with Rails 3.1pre5 and apparently the 'test' isn't rack-test.... is there a rack-test guard so you can use this with the default testing framework for Rails3.1?
Instance variables in models are also lost because each request is basically a blank slate.
The only thing to persist through requests are class variables, however, they too get lost when the server is shut down (or in the case of Phusion Passenger, the worker goes idle and gets removed).
To overcome these issues, use an external caching system. Rails has support for a few, like memcached.
I've recently switched from using this jQuery Token Input plugin in my Rails app, to the following jQuery plugin from Harvest:
http://harvesthq.github.com/chosen/
It's awesome. Check it out.
I've just implemented the tagging thing right into my system and built around it - and now I'm realising that I don't have a clue how to search for the tags. Is there any easy way to search (using something similar to the simple searching railscast) both my tutorial names and their tags (in which taggings are done via this tutorial).
My current super simple search code is below:
Any help?
Mountable engines was totally new to me before I watched this screencast. Therefor I have a couple of questions..
Would a use case example be to create a authentication and profile engine, then a blog engine, a forum engine etc and combine them all together under a "umbrella" app?
Is the mentioned use case a good way to create better scalable apps?
I guess you can create a engine within a engine as well?
Selenium so slow... I suggest use Thoughtbot's capybara-webkit https://github.com/thoughtbot/capybara-webkit
I'm sorry. I'm still a little unclear. I understand that instance variables of a controller are killed on every request. This is because every new request generates a new controller object (is this correct?). However, wouldn't the instance variables in a model last until model.destroy?
Otherwise, how is the lifetime of a model's instance variables defined?
I found that some error while testing with cucumber and fakeweb while you have @javascript tag on cucumber. It time out for some reason. Here is the issue https://github.com/chrisk/fakeweb/issues/25
here is my sollution http://ahmy.yulrizka.com/2011/08/cucumber-timeouterror-timeouterror-on-fakeweb/
I'm using rails 3.0.7 . As I was getting through this awesome cast I couldn't make my url
localhost:3000/article/2/comments
work:I spend hours trying to find out...later I got the solution ...
in
routes.rb
file i did:and then only
localhost:3000/article/2/comments
workedok, I managed to fix it. I had to tell rails to load my lib directory in my
config/application.rb
file by adding these lines:and using:
in my
routes.rb
Hope this helps
Hello, I am trying to implement the subdomains on my app. I am using rails 3.1.rc5. The problem is that "constraints" in my route.rb does not work and i am redirected to my app root. However if I use "constraint" (singular), my subdomain is parsed and i am succesfully routed to the show action of the controller i wanted (SchoolsController). The problem with this is that when i do not use a subdomain and therefore wish to be redirected to the root of my app, i get an "ActiveRecord::RecordNotFound" because it cannot find a School with that subdomain.
Anybody else having a similar issue? any ideas?
It's great for rails 3.0. But how it works with rails 3.1 without js.views, just with coffeescript... ?
Found the error. Seems that
record.save :validate => false
does this.Strange thing. When i put a job into queue when stalker is running, it repeats the same job over and over again and only stops if the job fails. Someone else with this?
We have found Cucumber to actually slow tests down a bit more than Capybara. You can easily use Cucumber and Capybara hand in hand if you would like.
The benefit would be more human readable cucumber steps which means being able to lay out a complete feature with a client or be able to show a client your feature file and having them be able to grasp what is going on.
Hello, i retrieve an error by submit "reset the Password":
Have anybody a Idea? Thanks!
It's placed in
lib/tasks/rebuild_token_auth.rake
then you can run it with
I've also had to check it out!
I see it's referred to inside the episode, so I've also added a link to the show notes. Thanks.
Hi,
I am using JQtouch for creating my application works for mobile.
I am already having an web application,now I just want application works on mobile.
But js files from public/javascript folder and also any js files from pugins not works for mobile app.
Any one having solution for this
??
Just did, it works :)
For some reason my Nearby Locations aren't working. I haven't tried to go past that part. I've tried copy and pasting the code into the right files and it still doesn't work :(. Anyone have an idea as to what would be causing this?
Great screencast! I realy love your "*from scratch" screencasts but i encountered some problems:
I had to use
save!(validate: false)
in the send_password_reset method after i added some validation on my user model. Why does the validation for the presence of a password and password_confirmation fire on the reset password form? And is there any way to validate only for a valid email withou using javascript?Another good example of engines is Spree Commerce. The engines are not mountable but you can see how powerful the concept is even without mounting and namespaces (which we plan to support.)
Solved it...
that needed to replace line 12 of the pastie code...
I am currently getting a
"can't convert Symbol into Integer"
error and I am not sure why...The offending lines are:
specifically the first line
Here is a pastie to my UrlHelper which is slightly modified...
http://pastie.org/private/nnfgboyxmarlcdh3nakokw
It's because the semantics don't work quite right. Migrations these days are timestamped, so you can roll back and forward in the order the migrations were applied, right? The timestamp is encoded in the migration file name.
If you just use migrations from the engine... they'll be timestamped with the time the developer of the engine created them, not the time your app actually first included/applied them.
The best thing I've found to do is have a generator which generates your engine/gem's migrations directly into the local rails app, with a filename with timestamp based on time-of-generation-into-local-app, and only doing this generation if a migration with the same name (not counting timestamp) does not already exist in local app (so the generation step is idempotent, and can be run for later versions of engine/gem and only add new migrations, not duplicate ones already generated).
This is my first two comments so I don't want to be too intrusive :), but the episode
104
looks at least as relevant as249
and149
:)