I am trying to import largish Excel files (~2MB) that are generated by an analysis program that we run. I am running into an issue where the open operation is exhausting the memory on my computer (I start with about 8 GiB free).
I have tried both Roo and the underlying Spreadsheet gem. Has anyone had any luck opening larger files?
I followed a railscast episode and got datatables up and running, beautifully along with the nice jquery-ui as in the front page.
The main issue I'm having though is that I suck at CoffeeScript/JS ~_~
I'm trying get the datatables to reload every 1 second but I don’t see any request coming into my webserver for refreshes and hence, no refreshes on the web page itself.
I am using Soulmate in production, and I am facing weird performance issues. The Soulmate sinatra app doesn't respond to some queries at all, whereas for other queries the performance is pretty good.
what if i have a signup page and it fails during the signing up how can i remain the URL of the page https://localhost:3000/signup and not https://localhost:3000/users
im using render action in the controller not redirect
I got this working great in the rails console, right off the bat. Fell in love immediately. Then when I implemented it in the views I kept getting "wrong number of arguments 0 for 1". Googling around I found I wasn't the only one, lots of people were getting that error and I couldn't really find a strait answer.
Eventually I restarted the rails session and BOOM, it works!
So
"wrong number of arguments 0 for 1" => try restarting session.
Excellent presentation, but its an excellent presentation of a kludge. After so many, "yes, but... no... do this.. but then that won't work the way it used to." twists, it is apparent that the problem wasn't with the pedagogy, but rather the feature itself.
Rails isn't ready for this solution, and I share with you the hope that new versions down the pike are more promising.
But (there is always a but lol) i have a problem ! (2 in fact)
I'm using ruby 3.2.11
if I try to use in my routes.rb :
ruby
scope module: :v1, constraints:ApiConstraints.new(version:1) do
I have an error message 'No route matches [GET] "/dev/v1/media"', if I use a namespace instead (but without constraints) it works! Any idea ? (my first namespace is dev not api)
Other problem, I specified the json format by default in my namespace, set the respond_to :json in my controller but if I use respond_with, got a error message "Missing Template", I need to use :
ruby
@media = Medium.all
respond_to do |format|
format.json { render json:@media, status::created }
end
Hi, very nice tutorial, I need to develop a very long form that will have many questions that will be optional based on the user inputs from a previous question for example:
Do you fever? Yes/No
(Questions appear in case user selected Yes)
Date it Started?
Temperature:
(Next question appears if user selected No)
Do you have allergies?
I will divide the form on several views but I would like some of the questions on the form only appearing if the users select the appropriate answer form the previous question.
Any ideas on how to implement this, thanks.
If not it'll get obsolete in no time. With competition from meteor, backbone and all the other js frameworks, people start asking: "Why do I need this bloated Rails stuff?" The whole convention over configuration is a double-edged sword. Users shouldn't (and therefore don't) know about the trivial (but hard to solve on you own) questions.
For example Rails solves crsf with one line in the application_controller. Many other frameworks requires more configuration and because its hard to understand that leads to solutions like "- just disable crsf". In rails you don't have to think about the trivial stuff, just make your application.
The browsers to day is no longer dumb terminals. So, we have to make them work more trough javascript and JSON. Rails have to make better conventions for better handling JSON and open connections if we want to keep it relevant. If we keep on mainly sending rendered HTML down to a (stupid) web browser, rails soon be the old hog.
This episode shows that still it is to much configuration. The rails core team should make decisions. Code should be simple like this
@Chris: Have you got it to work?
I have tried it (with simpleform and bootstrap) but doesn't work.
I have also tried the solution posted by Keil.
Any help would be appreciated.
That is the issue #1 with server-side processing. Whatever server-side search will be implemented, anyway it will searching against server-side 'look' of the data. Client-side search will find exactly what user wants even in complex cases.
So I would rather implement some pre-filtering by date or other parameters and pass all that filtered data to client-side.
Other issues, that not covered in this episode, like sorting on associated table values, can be solved relatively easy using joins.
Great topic, I waited for this a for a long time. Thanks!
One thing that I missing in this episode: Redis was described instead of PostgreSQL. Going to figure out how to do this with pgsql. Maybe this gem is applicable: https://github.com/ryandotsmith/queue_classic
On a serious note I was surprised you didn't mention your own gem 'private_pub'. (For which you have some pull-requests. One is actually quite good.
Anyway back on topic. I am currently running faye/private_pub in production and it has been doing relatively well. That said, my loads are pathetic. At most we have 50 users simultaneously using the system. Sometimes faye causes the browser to slow down ridiculously, at least on Chrome on Mac. Also messages get lost sometimes but I am not terribly worried about that. It's not critical data I am handling.
That said it just feels to me like the web has not been made for things like this. It feels like a dirty hackfest having to integrate 4 different pieces of software to make one thing more or less run. And this shows when you look at the hacky nature of what rails has done with it. I am used to rails being nice to use (not so much anymore. Rails got bloated... 'rbenv exec bundle exec rails c' great. real nice to type right?) but that controller just looks... ugly.
So I hope there will be a 'definate' solution to this problem in the future but I don't hold my hopes up.
There still seems to be a problem playing this video. It works if you manually skip to a few minutes in but the video freezes up after the intro graphic if you start from 0s. Strangely the audio is fine throughout.
I throw in my (in development) project that uses this tutorial: https://github.com/vadviktor/fse-rails
I hope it helps some people out there to get some grip.
Ryan, I've been watching a lot of railscasts, I'm lacking of knowledge in the subject, but there is a "Right way TM." to do a proper union in a "complex sql query" using ActiveRecord or Arel? I will show you what I'm trying to generate :(
sql
SELECT * FROM users WHERE id = (SELECT enrollable_id FROM enrollments WHERE enrollable_type='User')
UNION ALL
SELECT * FROM users WHERE id = (SELECT user_id FROM memberships WHERE group_id = (SELECT enrollable_id FROM enrollments WHERE enrollable_type='Group'))
Is awesome what you can get with Arel but I don't know if what I'm trying to do is breaking any rule or is just not possible using AR or Arel..
Hey Ryan,
First of all thanks for all your railscasts, they are fantasticly helpfull and well done.
I followed this one but all my uploads are very slow in any config I use (:fog, :s3)
I am on an EC2 medium instance and using s3 in same region.
Any other upload to the instance works at normal speed (I also upload zip files for other purposes). It's really when using carrierwave that the slowness appears.
If I save a user without avatar, it saves fast.
As soon as I upload an image (40k or 400k), it takes about 6/7 seconds to upload and generate 2 smaller versions thumbnails.
I tried to remove thumb creation, same thing (6/7 seconds)
Any clue what can be happening here ?
(Rails 3.1.10, carrierwave 0.5.8, fog 1.3.1)
Unfortunatly I can not use a backgrounder and carrierwave_direct seems more tricky to use in my case (all has to happen in same new/edit form)
Great cast...Thanks Ryan.
Note that Capybara 2.0 no longer includes Capybara methods by default in your request specs.
Did anyone find another solution than just using gem 'omniauth-facebook', '1.4.0' ?
Thank you very much), I am impressed)
I am trying to import largish Excel files (~2MB) that are generated by an analysis program that we run. I am running into an issue where the open operation is exhausting the memory on my computer (I start with about 8 GiB free).
I have tried both Roo and the underlying Spreadsheet gem. Has anyone had any luck opening larger files?
Hi
I followed a railscast episode and got datatables up and running, beautifully along with the nice jquery-ui as in the front page.
The main issue I'm having though is that I suck at CoffeeScript/JS ~_~
I'm trying get the datatables to reload every 1 second but I don’t see any request coming into my webserver for refreshes and hence, no refreshes on the web page itself.
Here's my code:
app/assets/javascripts/comments.js.coffee
And here is the code that gets generated on the client side:
Help will be appreciated. ^_^
I am using Soulmate in production, and I am facing weird performance issues. The Soulmate sinatra app doesn't respond to some queries at all, whereas for other queries the performance is pretty good.
Anyways, if you decide to use Soulmate, you should go through http://patshaughnessy.net/2011/11/23/finding-your-soulmate-autocomplete-with-redis-in-rails-3-1 and Salvatore's original post on doing autocomplete with redis - http://oldblog.antirez.com/post/autocomplete-with-redis.html
@Ryan It will be great if you can add these to the show notes.
The way soulmate does this is to add a
after_save
hook to load the term in to redis.Sir what i have a question i hope you can help me
what if i have a signup page and it fails during the signing up how can i remain the URL of the page https://localhost:3000/signup and not https://localhost:3000/users
im using render action in the controller not redirect
i really need your help sir thank you
Is there a way to update yml files in
config/locales/
automatically? So updated translations will get saved and cached later.thanks ryan but i can see the admin mode
I'm getting the following error when I load any page of my app:
Any rough idea as to why this is?
I got this working great in the rails console, right off the bat. Fell in love immediately. Then when I implemented it in the views I kept getting "wrong number of arguments 0 for 1". Googling around I found I wasn't the only one, lots of people were getting that error and I couldn't really find a strait answer.
Eventually I restarted the rails session and BOOM, it works!
So
"wrong number of arguments 0 for 1" => try restarting session.
+1. Thanks.
Excellent presentation, but its an excellent presentation of a kludge. After so many, "yes, but... no... do this.. but then that won't work the way it used to." twists, it is apparent that the problem wasn't with the pedagogy, but rather the feature itself.
Rails isn't ready for this solution, and I share with you the hope that new versions down the pike are more promising.
Can you please share how you made bootstrap-datepicker work?
With a .rbenv-version file and bundler binstubs I just type bin/rails c. Which you can alias.
This episode makes me a little sad.
It's almost easier to setup Faye to handle this.
Translations for Active Record Models
This method will help you, if i understood you correctly.
Hi, nice episode, very helpful.
But (there is always a but lol) i have a problem ! (2 in fact)
I'm using ruby 3.2.11
if I try to use in my routes.rb :
I have an error message 'No route matches [GET] "/dev/v1/media"', if I use a namespace instead (but without constraints) it works! Any idea ? (my first namespace is dev not api)
Other problem, I specified the json format by default in my namespace, set the respond_to :json in my controller but if I use respond_with, got a error message "Missing Template", I need to use :
Any idea ?
Thanks :)
Hi, very nice tutorial, I need to develop a very long form that will have many questions that will be optional based on the user inputs from a previous question for example:
Do you fever? Yes/No
(Questions appear in case user selected Yes)
Date it Started?
Temperature:
(Next question appears if user selected No)
Do you have allergies?
I will divide the form on several views but I would like some of the questions on the form only appearing if the users select the appropriate answer form the previous question.
Any ideas on how to implement this, thanks.
Rails has to move in this direction.
If not it'll get obsolete in no time. With competition from meteor, backbone and all the other js frameworks, people start asking: "Why do I need this bloated Rails stuff?" The whole convention over configuration is a double-edged sword. Users shouldn't (and therefore don't) know about the trivial (but hard to solve on you own) questions.
For example Rails solves crsf with one line in the application_controller. Many other frameworks requires more configuration and because its hard to understand that leads to solutions like "- just disable crsf". In rails you don't have to think about the trivial stuff, just make your application.
The browsers to day is no longer dumb terminals. So, we have to make them work more trough javascript and JSON. Rails have to make better conventions for better handling JSON and open connections if we want to keep it relevant. If we keep on mainly sending rendered HTML down to a (stupid) web browser, rails soon be the old hog.
This episode shows that still it is to much configuration. The rails core team should make decisions. Code should be simple like this
@Chris: Have you got it to work?
I have tried it (with simpleform and bootstrap) but doesn't work.
I have also tried the solution posted by Keil.
Any help would be appreciated.
That is the issue #1 with server-side processing. Whatever server-side search will be implemented, anyway it will searching against server-side 'look' of the data. Client-side search will find exactly what user wants even in complex cases.
So I would rather implement some pre-filtering by date or other parameters and pass all that filtered data to client-side.
Other issues, that not covered in this episode, like sorting on associated table values, can be solved relatively easy using joins.
Great suggestion thanks!
trying this with guard and capybara right now!
rake sorcery:bootstrap is deprecated.
It is now rails generate sorcery:install
Those will only work in development environment, so there's no need to worry about that in production.
a revised version would be great!
Also in Ubuntu 12 you should generate keys:
$ ssh-keygen -t rsa -C "your@mail.com"
I found the solution. Do this:
I try to add admin user on Ubuntu 12.04 LTS:
Does anyone know how to fix that?
Great topic, I waited for this a for a long time. Thanks!
One thing that I missing in this episode: Redis was described instead of PostgreSQL. Going to figure out how to do this with pgsql. Maybe this gem is applicable: https://github.com/ryandotsmith/queue_classic
Controller looks ugly? Move stuff to separate class.
Command is too long? Make an alias.
Torquebox looks great! How easy is it to migrate? Is anyone using it in production?
A bit late, but I hope this helps explain how to iterate over an arbitrary time period: http://stackoverflow.com/questions/501253/iterate-over-ruby-time-object-with-delta
Stefano: use play with scala for websockets, or just use http://torquebox.org/features/
10x for the video!
Frist!
On a serious note I was surprised you didn't mention your own gem 'private_pub'. (For which you have some pull-requests. One is actually quite good.
Anyway back on topic. I am currently running faye/private_pub in production and it has been doing relatively well. That said, my loads are pathetic. At most we have 50 users simultaneously using the system. Sometimes faye causes the browser to slow down ridiculously, at least on Chrome on Mac. Also messages get lost sometimes but I am not terribly worried about that. It's not critical data I am handling.
That said it just feels to me like the web has not been made for things like this. It feels like a dirty hackfest having to integrate 4 different pieces of software to make one thing more or less run. And this shows when you look at the hacky nature of what rails has done with it. I am used to rails being nice to use (not so much anymore. Rails got bloated... 'rbenv exec bundle exec rails c' great. real nice to type right?) but that controller just looks... ugly.
So I hope there will be a 'definate' solution to this problem in the future but I don't hold my hopes up.
I suggest using minitest-spec-rails
https://github.com/metaskills/minitest-spec-rails
Thanks Mark Wilson! that was my problem. Spent a day on it. I didn't see your comment yesterday! Thanks again
There still seems to be a problem playing this video. It works if you manually skip to a few minutes in but the video freezes up after the intro graphic if you start from 0s. Strangely the audio is fine throughout.
I throw in my (in development) project that uses this tutorial:
https://github.com/vadviktor/fse-rails
I hope it helps some people out there to get some grip.
Does anyone know how to load photos AFTER clicking the submit button in form?
I have FF and Chrome working on my latest site using this tutorial.
I am developing a site right now using this tutorial and everything works fine. Maybe you have some dependencies unsolved on OS side.
Ryan, I've been watching a lot of railscasts, I'm lacking of knowledge in the subject, but there is a "Right way TM." to do a proper union in a "complex sql query" using ActiveRecord or Arel? I will show you what I'm trying to generate :(
Is awesome what you can get with Arel but I don't know if what I'm trying to do is breaking any rule or is just not possible using AR or Arel..
Thanks for letting us know, I've corrected the ASCIIcast text :)
You rock, dude.
This was really helpful, just one typo in the ASCIIcast that was a gotcha for me when I copy and pasted.
CONFIG.merge! config.fetch(Rails.env, {})
should be
CONFIG.merge! CONFIG.fetch(Rails.env, {})
+1
Hey Ryan,
First of all thanks for all your railscasts, they are fantasticly helpfull and well done.
I followed this one but all my uploads are very slow in any config I use (:fog, :s3)
I am on an EC2 medium instance and using s3 in same region.
Any other upload to the instance works at normal speed (I also upload zip files for other purposes). It's really when using carrierwave that the slowness appears.
If I save a user without avatar, it saves fast.
As soon as I upload an image (40k or 400k), it takes about 6/7 seconds to upload and generate 2 smaller versions thumbnails.
I tried to remove thumb creation, same thing (6/7 seconds)
Any clue what can be happening here ?
(Rails 3.1.10, carrierwave 0.5.8, fog 1.3.1)
Unfortunatly I can not use a backgrounder and carrierwave_direct seems more tricky to use in my case (all has to happen in same new/edit form)
Thanks a lot
Phil