One problem I've had with importing CSV files from real users is often they aren't always valid, i.e., they include extended characters, are encoded weirdly, or are otherwise malformed leading to many parsing errors. Finally if they include headers at all they do not match that names of the attributes in the Rails model.
The users who send me files like these are also the least technical so hardest for them to clean up themselves or understand why files are invalid.
Would like to see more about error handling, or know what people do with these real world messy files. Thanks.
When trying to tag an article, lets say "chemistry, sept 20/2012" as in want to organize all the articles posted on a certain date.
How do you rewrite the routes.rb:
get 'tags/:tag', to: 'articles#index', as: :tag
in order to access tag names that embed "/" forward slash?!
I get this error when I try to access sept 20/2012:
No route matches [GET] "/tags/sept%2020/2012"
I am getting this error through signin process "The token URL or xdReceiver has not been whitelisted". I visited their support blog but I didn't find anything useful.does nayone knows how to solve that??
I must say that I completely disagree with these latest sentiments. I think that every developer should spend time understanding the tools that they use (which INCLUDES reading the source code). I don't consider developers who use rails to be exempt to this.
Rails is complicated and intertwined (as you can see from the screencast). Most people, when first viewing the code get overwhelmed quickly. These walkthroughs show how you should read through source code and put together the pieces to gain an understanding of how things are put together.
I, for one, applaud the effort spent on more 'advanced' screencasts.
If you aren't creating too many of these routes I think the best way to do this is with static routes - e.g. get "/pricing" => "pages#pricing". It isn't strictly restful, but I think people sometimes go overboard with that. Not only is this simpler, but it also avoids the catch-all route issue mentioned as well as database performance issues brought up.
Friendly_ID was working for me before I edited by After editing the _add_slug_to_users.rb file then ran the command User.find_each(&:save)
For each user, I got an error that was similar to:
User Load (0.3ms) SELECT "users".* FROM "users" WHERE ("slug" = 'carleton-howell' OR "slug" LIKE 'carleton-howell--%'ESCAPE '\') AND (id <> 2) ORDER BY LENGTH("slug") DESC, "slug" DESC LIMIT 1
User Exists (0.2ms) SELECT 1 AS one FROM "users" WHERE (LOWER("users"."email") = LOWER('example-1@railstutorial.org') AND "users"."id" != 2) LIMIT 1
(0.1ms) rollback transaction
For simple to_param overrides that append a name to the ID, I wrote a really simple gem called pretty_param. You can check out the logic https://github.com/kaiuhl/pretty-param/blob/master/lib/pretty_param.rb, but essentially it's just a better DSL for the most common to_param overrides with better filtering of special characters.
This is a really great solution! I've been searching all over for something like this and managed to implement without a hitch. One question though - is there any way to stop if spawning a new page every time you click on a link, and so it simply send you to the link path rather than creating another separate page with url?
In addition to the resources mentioned in this cast, you could also check Ohloh to see some interesting statistics about the project's code, or even to compare two or three projects. For example, Ohloh's page for Devise shows how long the project has been active, and how many active contributors worked on it over the years.
Nice episode, one question... I am trying to integrate this with facebook login using omniauth, but the return url using this configuration will be "unicorn" what doesn't match the url on facebook app. How can I make facebook accept this configuration? Thanks for any help.
I'm pretty much a noobie when it comes to writing jQuery and am trying to fade out an item as it is deleted. I have tried the following in my destroy.js.erb file - the item is deleted but does not fade away so stays on the page until the page is reloaded.
ruby
$('#item_div').fadeOut("500").remove()
If I take out the fadeOut part, it successfully disappears from the page.
Would someone mind pointing me in the right direction?
can you please explain how multicolumn search? i implemented the code of ryan from episode 340 and i have problem to implement multi column seach. if you can also post some code it will be really awesome.
thanks in advance
Ryan, Over the years, I have benefitted from your RailsCasts a lot. So I say this with nothing but sincere appreciation for what you have done and are doing for the Rails community. I totally second Sergey Kuleshov is saying above.
Please focus on specific topics that can be useful for a Rails developer and leave the innards of Rails to the Rails core team members and others who might be interested.
I am sorry to say but the walkthrough videos aren't the best of your creations. What I value a lot in your normal screencasts is that they scratch a very specific itch and show how to integrate thing that wouldn't otherwise be obvious.
I am not sure which purpose the walkthroughs server though. They are very generic, moreover experienced rails devs can read the code and figure this stuff out. Novice developers will feel lost anyway.
I did this with the jquery-raty-rails gem and it works quite well.
My current problem is displaying the value of the vote the current_user gave to my model. The average vote for my model is no problem via Model.reputation_for(:votes)
Thanks for this! I signed up for Pro just to watch this episode... I think it would be great to include a version of this that would work with a mobile app using backbone. Any advice on how to do that?
I have since separated the two since it was causing even more problems when I was plotting the events on the calendar. I know its not the best solution to separate the date and time as two data fields but I got it working rather painless.
So dumping orders array into data-attribute exposes all the attributes stored in db to Morris. What would be the best way to inject virtual attributes to the objects in array handed over to javascript side?
The reason is unicorn_init.sh file doesn't have execute flag on server site.
To do that let's add following line into deploy.rb at :symlink_config task section:
Is there a technical reason for chosing the "Ancestry" gem rather than the "Awesome nested set" gem ? The second one seems to be more popular for few months no ?
I'm afraid that, if I start building my app with Ancestry, it could be deprecated in few weeks. :/
I follow the tutorial closely but my "Add Question" does not work. When I click on it, nothing happens. When I look into Chrome developer tool, it does not seem like the javascript is executed. Can anyone advise? What are the things I could possibly miss?
While I was thinking about it, I migrated to Turbolinks. Since I use bootstrap, I needed the https://github.com/kossnocorp/jquery.turbolinks gem to deal with the fact that bootstrap binds events to the body tag (this will be fixed in future releases to use the html tag).
Also, I use Turbolinks for my forms (like search) that use GET
It was easy (1-2 days) for me to migrate my Rails 3.2 desktop app to use PJAX via the rack-pjax gem. I picked that gem because you specify the container. I chose to just PJAX the content between my header and footer tags.
However, I have a feeling that most of the performance win comes from not reprocessing the head tag so I would expect that just fragmenting the entire body is good enuff. When I get the time, I'll migrate from PJAX to Turbolinks.
Has anyone had any experience integrating either PJAX or Turbolinks with jQuery Mobile. JQM does has it's own pushState manager and converts all links into AJAX requests. It also does DOM caching of those pages so there are several issues to consider.
Great topic.
One problem I've had with importing CSV files from real users is often they aren't always valid, i.e., they include extended characters, are encoded weirdly, or are otherwise malformed leading to many parsing errors. Finally if they include headers at all they do not match that names of the attributes in the Rails model.
The users who send me files like these are also the least technical so hardest for them to clean up themselves or understand why files are invalid.
Would like to see more about error handling, or know what people do with these real world messy files. Thanks.
When trying to tag an article, lets say "chemistry, sept 20/2012" as in want to organize all the articles posted on a certain date.
How do you rewrite the routes.rb:
get 'tags/:tag', to: 'articles#index', as: :tag
in order to access tag names that embed "/" forward slash?!
I get this error when I try to access sept 20/2012:
No route matches [GET] "/tags/sept%2020/2012"
I am getting this error through signin process "The token URL or xdReceiver has not been whitelisted". I visited their support blog but I didn't find anything useful.does nayone knows how to solve that??
I must say that I completely disagree with these latest sentiments. I think that every developer should spend time understanding the tools that they use (which INCLUDES reading the source code). I don't consider developers who use rails to be exempt to this.
Rails is complicated and intertwined (as you can see from the screencast). Most people, when first viewing the code get overwhelmed quickly. These walkthroughs show how you should read through source code and put together the pieces to gain an understanding of how things are put together.
I, for one, applaud the effort spent on more 'advanced' screencasts.
Definitely interested in this
It would be neat if you showed how to make the slugs unique only to their parents and not site wide.
If you aren't creating too many of these routes I think the best way to do this is with static routes - e.g. get "/pricing" => "pages#pricing". It isn't strictly restful, but I think people sometimes go overboard with that. Not only is this simpler, but it also avoids the catch-all route issue mentioned as well as database performance issues brought up.
hmm can you elaborate Jeff?
Found the issue which was that it an edit needs to be made for it to work with existing entries on Heroku :)
Friendly_ID was working for me before I edited by After editing the _add_slug_to_users.rb file then ran the command User.find_each(&:save)
For each user, I got an error that was similar to:
User Load (0.3ms) SELECT "users".* FROM "users" WHERE ("slug" = 'carleton-howell' OR "slug" LIKE 'carleton-howell--%'ESCAPE '\') AND (id <> 2) ORDER BY LENGTH("slug") DESC, "slug" DESC LIMIT 1
User Exists (0.2ms) SELECT 1 AS one FROM "users" WHERE (LOWER("users"."email") = LOWER('example-1@railstutorial.org') AND "users"."id" != 2) LIMIT 1
(0.1ms) rollback transaction
no problem, i remember that biting me in the butt once too :/
Hi,
I need files to be renamed before uploading
I get this to work :
But I need the extension at the end and this doesn't work:
Thanks for the help
For simple to_param overrides that append a name to the ID, I wrote a really simple gem called pretty_param. You can check out the logic https://github.com/kaiuhl/pretty-param/blob/master/lib/pretty_param.rb, but essentially it's just a better DSL for the most common to_param overrides with better filtering of special characters.
Hi adam-pl,
This is a really great solution! I've been searching all over for something like this and managed to implement without a hitch. One question though - is there any way to stop if spawning a new page every time you click on a link, and so it simply send you to the link path rather than creating another separate page with url?
Thanks!
Mark
In addition to the resources mentioned in this cast, you could also check Ohloh to see some interesting statistics about the project's code, or even to compare two or three projects. For example, Ohloh's page for Devise shows how long the project has been active, and how many active contributors worked on it over the years.
+1
Nice episode, one question... I am trying to integrate this with facebook login using omniauth, but the return url using this configuration will be "unicorn" what doesn't match the url on facebook app. How can I make facebook accept this configuration? Thanks for any help.
With mercury 0.9 the posted js didnt work for me anymore so I tried araound a bit... This works for me, maybe somebody needs this,...
Thank you so much :)
You need to hook the remove method into a callback function which is executed once the fadeOut method finishes, like so:
I'm pretty much a noobie when it comes to writing jQuery and am trying to fade out an item as it is deleted. I have tried the following in my destroy.js.erb file - the item is deleted but does not fade away so stays on the page until the page is reloaded.
If I take out the fadeOut part, it successfully disappears from the page.
Would someone mind pointing me in the right direction?
It's good to have a
constraints: { format: :html }
so images and other files 404 correctly. Otherwise you're going to get a lot of 500's?? I used the above solution from ziemekwolski and I still get nothing back when i search for say "anky" but I get results back when doing:
@dr_wallaches = DrWallach.where("callers like ? or monologue like ?","%#{params[:search][:terms]}%","%#{params[:search][:terms]}%")
can you please explain how multicolumn search? i implemented the code of ryan from episode 340 and i have problem to implement multi column seach. if you can also post some code it will be really awesome.
thanks in advance
Ryan, Over the years, I have benefitted from your RailsCasts a lot. So I say this with nothing but sincere appreciation for what you have done and are doing for the Rails community. I totally second Sergey Kuleshov is saying above.
Please focus on specific topics that can be useful for a Rails developer and leave the innards of Rails to the Rails core team members and others who might be interested.
How can we implement Ransack gem with Datatables gem?
it seems that the application is not working (https://github.com/railscasts/381-jquery-file-upload/blob/master/gallery-after)
nothing happens when I select images
I am sorry to say but the walkthrough videos aren't the best of your creations. What I value a lot in your normal screencasts is that they scratch a very specific itch and show how to integrate thing that wouldn't otherwise be obvious.
I am not sure which purpose the walkthroughs server though. They are very generic, moreover experienced rails devs can read the code and figure this stuff out. Novice developers will feel lost anyway.
I got following Error:
Error: A field was longer or shorter than the server allows.
use pry-debugger plugin
I did this with the jquery-raty-rails gem and it works quite well.
My current problem is displaying the value of the vote the current_user gave to my model. The average vote for my model is no problem via Model.reputation_for(:votes)
Luis's suggestion has many options including removing the slider. Check out all the examples and most likely one of them will fit your needs
Thanks for this! I signed up for Pro just to watch this episode... I think it would be great to include a version of this that would work with a mobile app using backbone. Any advice on how to do that?
I have since separated the two since it was causing even more problems when I was plotting the events on the calendar. I know its not the best solution to separate the date and time as two data fields but I got it working rather painless.
Still would love to hear any better ideas
so I have a datetime field in my modle and I have seperated them by:
and this works fine. I have then change the date select to a
f.text_field
and applied whats discussed in the video. and I produce this error:1 error(s) on assignment of multiparameter attributes
If I comment out the
f.time_select
line like so:everything works fine except that the time is saved as
00:00:00
of course. Any one have any clue on how to get this working right?So dumping orders array into data-attribute exposes all the attributes stored in db to Morris. What would be the best way to inject virtual attributes to the objects in array handed over to javascript side?
I've also had the same problem.
The reason is
unicorn_init.sh
file doesn't haveexecute
flag on server site.To do that let's add following line into
deploy.rb
at:symlink_config
task section:sudo "chmod +x #{release_path}/config/unicorn_init.sh"
Finally
:symlink_config
task's code is:You do not have replace any
run
intosudo
.For me it works fine.
These walkthroughs are great. I used to have time to do such research but working and school make it impossible. Worth the membership fee for sure.
Any other plugins you guys like?
Thanks for this episode.
Is there a technical reason for chosing the "Ancestry" gem rather than the "Awesome nested set" gem ? The second one seems to be more popular for few months no ?
I'm afraid that, if I start building my app with Ancestry, it could be deprecated in few weeks. :/
Thank you ryan and keep it always up :-)
I second the comment above, this episode should be revised, please!
I follow the tutorial closely but my "Add Question" does not work. When I click on it, nothing happens. When I look into Chrome developer tool, it does not seem like the javascript is executed. Can anyone advise? What are the things I could possibly miss?
While I was thinking about it, I migrated to Turbolinks. Since I use bootstrap, I needed the https://github.com/kossnocorp/jquery.turbolinks gem to deal with the fact that bootstrap binds events to the body tag (this will be fixed in future releases to use the html tag).
Also, I use Turbolinks for my forms (like search) that use GET
Adding it outside the :production group works for me
(assets weren't being found in :development)
I thought
simple_format
might be new... then I found that it was added 8 years ago :PI use the old hash syntax for state transitions for the same reason. An good example of where language syntax flexibility is neat.
Cheers for that, twler.
It was easy (1-2 days) for me to migrate my Rails 3.2 desktop app to use PJAX via the rack-pjax gem. I picked that gem because you specify the container. I chose to just PJAX the content between my header and footer tags.
However, I have a feeling that most of the performance win comes from not reprocessing the head tag so I would expect that just fragmenting the entire body is good enuff. When I get the time, I'll migrate from PJAX to Turbolinks.
Has anyone had any experience integrating either PJAX or Turbolinks with jQuery Mobile. JQM does has it's own pushState manager and converts all links into AJAX requests. It also does DOM caching of those pages so there are several issues to consider.
Anyone realize that tokeninput doesn't work on IE9? Seems like a pretty obvious no-go considering 17% of the internet still uses IE.