|
"error": { "type": "OAuthException", "message": "Invalid redirect_uri: Given URL is not allowed by the Application configuration." I've read that changing my hosts file can fix this, but it has not worked for me. Does anyone know how I can get facebook to recognized a localhost machine? I'm going to keep trying because this is driving me insane. Edit: My changes worked, sanity restored. Oh My Science fucked around with this message at 00:04 on Nov 10, 2010 |
# ? Nov 10, 2010 00:00 |
|
|
# ? Jun 4, 2024 15:08 |
|
How do I use one of my layouts for devise? I already ran quote:rails g devise:views and it moved all the devise views for me, but it didnt create a controller for me to to use my layout.
|
# ? Nov 11, 2010 05:22 |
|
I'm getting a strange warning that I can't figure out with my google-fu:code:
It's just a warning, but any thoughts on what could be causing it?
|
# ? Nov 11, 2010 06:11 |
|
rugbert posted:How do I use one of my layouts for devise? I already ran Yeah devise:views doesn't bring the devise controller with it, just the views. All you need to do is create a custom controller that defines what layout you want to use when rendering anything from devise.
|
# ? Nov 11, 2010 06:39 |
|
IsotopeOrange posted:I'm getting a strange warning that I can't figure out with my google-fu: Somewhere ( in your code or in one of your gems ), there's a require to json/pure that's happening after a require to json or json/ext. The pure one is in just ruby, and ext is in C. There is never* a reason to pick one of those two. Just doing require json will try to load the ext version, then fall back to pure. So look for those requires, and if it's in a gem you use, fix it and send a pull request. * i can't think of any reason off the top of my head…
|
# ? Nov 11, 2010 17:56 |
|
BrokenDynasty posted:Yeah devise:views doesn't bring the devise controller with it, just the views. All you need to do is create a custom controller that defines what layout you want to use when rendering anything from devise. I guess I would have to create a controller for each view then? I jumped into the devise gem and saw that there are controllers for each view inheriting from application controller. I was hoping to do it all in one spot, I dont know how tho, Im still really new to rails.
|
# ? Nov 11, 2010 20:45 |
|
I'm having a javascript problem, but I think it might really be a RoR problem. I'm a bit new at rails, and very new to javascript. Basically, I need to use keyboard shortcuts to navigate to links, so I downloaded this little bit of java script: http://code.google.com/p/prototype-hotkeys/ . It gives a javascript function, Hotkeys.bind(key_combination, function). I use this function by putting in a script tag at the beginning of one of my views, just to test it.code:
In general, what are some other alternatives for binding keys to link navigation and other functions, like scope navigation?
|
# ? Nov 16, 2010 15:48 |
|
SamMalone posted:I'm having a javascript problem, but I think it might really be a RoR problem. I'm a bit new at rails, and very new to javascript. Basically, I need to use keyboard shortcuts to navigate to links, so I downloaded this little bit of java script: http://code.google.com/p/prototype-hotkeys/ . It gives a javascript function, Hotkeys.bind(key_combination, function). I use this function by putting in a script tag at the beginning of one of my views, just to test it. You need to put bindings in an document load function, or the Javascript just executes line by line. code:
|
# ? Nov 16, 2010 15:54 |
|
I have a model called Image, and have paperclip attaching files to entries in it for an image gallery, and while I can upload and edit files just fine, whenever I try to delete a file clicking my delete linkcode:
|
# ? Nov 16, 2010 22:18 |
|
Post 'rake routes'
|
# ? Nov 16, 2010 22:26 |
|
rugbert posted:I have a model called Image, and have paperclip attaching files to entries in it for an image gallery, and while I can upload and edit files just fine, whenever I try to delete a file clicking my delete link Do you have something like this in your config/routes.rb ? code:
|
# ? Nov 16, 2010 23:22 |
|
Here are the routes for the images section:code:
code:
|
# ? Nov 17, 2010 00:04 |
|
rugbert posted:Here are the routes for the images section:
|
# ? Nov 17, 2010 00:06 |
|
rugbert posted:Here are the routes for the images section: Is your controller ImagesController or Admin::ImagesController? For the former you want to use scope, for the later you want to use namespace. See the rails guide for the details. http://guides.rubyonrails.org/routing.html EDIT: Although I'm not sure if that would explain why you're getting an error for the route not existing. My suggestion is for when it finds the route but cannot find the resource. IsotopeOrange fucked around with this message at 01:33 on Nov 17, 2010 |
# ? Nov 17, 2010 01:29 |
|
rugbert posted:And in my routes file I have
|
# ? Nov 17, 2010 01:35 |
|
IsotopeOrange posted:Is your controller ImagesController or Admin::ImagesController? For the former you want to use scope, for the later you want to use namespace. See the rails guide for the details. http://guides.rubyonrails.org/routing.html Admin:ImagesController Im still pretty new to rails but it seem like it SHOULD work to me, I mean, the edit route works just fine. I took out the :except => :show and its definitely trying to use the show action. Its like its completely ignoring the delete Im giving it. I went into the controller and defined show and had it pull the image but I get an error about my template missing? rugbert fucked around with this message at 01:52 on Nov 17, 2010 |
# ? Nov 17, 2010 01:40 |
|
rugbert posted:Admin:ImagesController My money is on your javascript not being hooked up right. As of rails3, link_to a non get method will throw on a data-method attribute to the link. Your js library has to listen for the click and then do a post with _method=delete instead. It should work out of the box with prototype, but maybe you switched to jquery and didn't install the new listeners, or don't have the prototype stuff in your layout anymore.
|
# ? Nov 17, 2010 04:21 |
|
SamMalone posted:I'm having a javascript problem, but I think it might really be a RoR problem. I'm a bit new at rails, and very new to javascript. Basically, I need to use keyboard shortcuts to navigate to links, so I downloaded this little bit of java script: http://code.google.com/p/prototype-hotkeys/ . It gives a javascript function, Hotkeys.bind(key_combination, function). I use this function by putting in a script tag at the beginning of one of my views, just to test it. I'm not sure if what NotShadowStar posted has anything to do with it, but here's the problem that I see. Notice that the second parameter you're passing in is alert("what"). You're not passing in the alert function itself -- you're calling alert and then passing the return value of that function (undefined) as the second parameter. That explains why you get the alert when the page loads and not when you press the hotkey. The function gets called when the page loads, triggering the alert. You pass in undefined so Hotkey.bind has no function to execute when you press the hotkey. The solution is to instead pass in an actual function. Try this: code:
|
# ? Nov 17, 2010 06:25 |
|
Pardot posted:My money is on your javascript not being hooked up right. As of rails3, link_to a non get method will throw on a data-method attribute to the link. Your js library has to listen for the click and then do a post with _method=delete instead. That could be it, I sorta maybe possibly deleted all the default javascript files when I started this project. This is my friend's dads site I had made, but it was a static site and wanted to learn rails by turning it into a CMS so I guess I assumed I didnt need those files. I just re-added prototype.js and the layout is calling :all javascripts but yea, I still get that routing error. rugbert fucked around with this message at 15:38 on Nov 17, 2010 |
# ? Nov 17, 2010 15:31 |
|
I assume since I have been using Rails (especially Rails 3) for a little while now that I am spoiled beyond repair with regard to ease of web application development. What I am looking for after having constructed a complicated application, is some way of analyzing and picking at what is being rendered into HTML for me. There are partials everywhere, coupled with helpers, coupled with information spread across lots of different database tables. There are several places where database information is being eagerly loaded and other places where the assumption is that the page information is cached etc. Are there any gems available that will sort of... make it easier to see exactly what is going on? The reading I have done has led me to believe I need to write performance based tests, but those don't really tell me everything I am hoping to more easily know. Maybe some kind of gem that monitors everything my application is doing and then creates a big beautiful page that details where all of the bottlenecks and rendering hogs are. Is there something like that? code:
|
# ? Nov 18, 2010 14:55 |
|
Nolgthorn posted:Is there something like that? There is NewRelic: http://www.newrelic.com/RPMlite-rails.html Its pricey if your app isn't out making lots of cash but invaluable. You can analyze individual queries, see a log of errors, performance stats, the works. It even emails you a nice weekly summary. I didn't have a chance to really try it out thoroughly before my Gold trial came up, so I'm stuck on Lite until we release the app that using it. My experiences with Lite have been positive though. Lite doesn't tell you much but you are able to get a general idea if the server is coping well with the average user load, which is really important to us as the app is on a VPS that we can dial up when we run out of capacity.
|
# ? Nov 18, 2010 15:22 |
|
Nolgthorn posted:I assume since I have been using Rails (especially Rails 3) for a little while now that I am spoiled beyond repair with regard to ease of web application development. -Production vs Development is orders of magnitude faster. Push it to Heroku and see what your response times are to see how it would work in a real server environment. -Read this to see what common (surprising) performance issues are in the Ruby language.
|
# ? Nov 18, 2010 15:31 |
|
NotShadowStar posted:-Read this to see what common (surprising) performance issues are in the Ruby language. Thanks. That was a really interesting article. I'm still a 2.3.x holdout because I'm waiting for things like this to be fully worked over before I take the time to switch my apps. May I ask, have you gone through porting a 2.3.x app to 3.x? How was it? Were the changes required significant?
|
# ? Nov 18, 2010 15:39 |
|
8ender posted:Thanks. That was a really interesting article. I'm still a 2.3.x holdout because I'm waiting for things like this to be fully worked over before I take the time to switch my apps. http://blog.shopify.com/2010/11/16/our-upgrade-to-rails-3
|
# ? Nov 18, 2010 15:49 |
|
NotShadowStar posted:-Read this to see what common (surprising) performance issues are in the Ruby language. Although the video isn't up yet, keep on eye on this url. Aaron Patterson elaborated quite a bit on that blog post at RubyConf last week.
|
# ? Nov 18, 2010 18:25 |
|
NotShadowStar posted:http://blog.shopify.com/2010/11/16/our-upgrade-to-rails-3 Sweet jesus just look at all those changes. Their app is monstrous in comparison so I'm hoping ours won't be a bastard to port. I'm gathering from the article that the best thing I can do ahead of time is making sure our tests are thorough and well written. Thats good advice for any application but I think in our case we should bone up on functional tests.
|
# ? Nov 18, 2010 19:10 |
|
Shopify is a monster app. One of the biggest around, it started when Rails was brand new and kept going. The point is they did it, so you can to, because your app is probably much much smaller. It's mostly not that big of a deal, there's an official library that looks through your code for common problems https://github.com/rails/rails_upgrade. The biggest change will be the new query interface, but pay attention to any depreciation warnings in the console and fix them as you go along. Any sort of testing is going to save your rear end no matter if you're doing a major functional change, upgrading platforms or just skipping through iterations. Personally I have a dual-testing approach, using Cucumber for describing external outside-in functionality, and normal RSpec for ensuring that custom model behavior works at the model level. 37signals just uses Test::Unit (http://twitter.com/dhh/status/27444365459). Whatever works, just do SOMETHING.
|
# ? Nov 18, 2010 19:43 |
|
8ender posted:There is NewRelic: Interesting. Thank you for giving me a jump off point, I didn't realize that such a thing would be so expensive. The few automated options available seem to be fairly... well dishonest. I don't think that the software only being able to update data once every 10 minutes unless I upgrade to a much more expensive version is very accurately reflecting their costs for the service, for example. For these prices I feel like just using my brain, going through the code and reading logs manually instead.
|
# ? Nov 18, 2010 19:47 |
|
Nolgthorn posted:Interesting. Thank you for giving me a jump off point, I didn't realize that such a thing would be so expensive. Again I really think a service like Relic shines when you have a real big app seeing lots of traffic. The kind of app where you'd want a nice at a glance dashboard showing how your app and servers are coping with requests and where the bottlenecks are on a day to day basis without diving deep into logs. I personally find the console logging that Mongrel does on the command line to be invaluable. You see what, how many, and how long queries took which usually accounts for the bulk of time it takes to serve up a page.
|
# ? Nov 18, 2010 20:06 |
|
Nolgthorn posted:For these prices I feel like just using my brain, going through the code and reading logs manually instead. You can also just use it locally in development mode. Just browse a few pages and then go to /newrelic. It will at least give you more context than just eyeballing the code and logs.
|
# ? Nov 19, 2010 20:56 |
|
Pardot posted:My money is on your javascript not being hooked up right. As of rails3, link_to a non get method will throw on a data-method attribute to the link. Your js library has to listen for the click and then do a post with _method=delete instead. Ok yea, youre totally right. The problem was, the layout I was using was calling :all javascripts so I guess something in jquery was loving things up. Thankfully the admin secion doesnt need the jquery effects the rest of the site does. For future reference, what if I do need some jquery magic?
|
# ? Nov 20, 2010 01:49 |
|
rugbert posted:Ok yea, youre totally right. The problem was, the layout I was using was calling :all javascripts so I guess something in jquery was loving things up. Thankfully the admin secion doesnt need the jquery effects the rest of the site does. If I'm understanding the situation correctly, I think the original problem was that you deleted all of Rails's default JavaScript files. To elaborate on what Pardot said, when you tried to use <%= link_to "Delete", admin_image_path(i), :method => :delete, :confirm =>"Are you sure?" %>, the only difference between that and <%= link_to "Delete", admin_image_path(i) %> in Rails 3 is that it'll add the following two HTML attributes to the link: data-confirm="Are you sure?" and data-method="delete". The key to those two attributes making the link a delete link is the rails.js file. Without it, the link will go to the resource's show action, and the error came from the fact that that route didn't exist. It sounds like you added all of the files you deleted back, and included jquery in addition to them. I think the reason you continued to get the error is that mixing jquery and prototype doesn't work straight out of the box. Both jquery and prototype are both referenced through the dollar sign variable, so including them both on the same page can cause conflicts. There's ways to get them to work together but there's no real reason to use both at the same time. For future reference, looking at your javascript console is a good way to determine if something like this is happening. Since you want to use jquery, you can just get rid of prototype. The issue with doing that is that rails.js depends on prototype. The solution is to replace the default rails.js that uses prototype with this one that uses jquery. Once you do that, you can safely delete prototype.js and just use jquery, and your delete link should still be happy.
|
# ? Nov 20, 2010 10:42 |
|
Gordon Cole posted:Answer Awesome, thanks! On a completely other note. I just moved over to Lithium hosting and am trying to install some ruby apps. Having never used cpanel before Im running into a few problems. I can create the app just fine, it will run bam everything is gravy. But how do I upload MY app from my laptop? I FTPd my poo poo over to the directory cpanel made and replaced its contents but that breaks the app and it wont run.
|
# ? Nov 20, 2010 18:46 |
|
rugbert posted:Awesome, thanks! Have you tried heroku? It's free to start and deploying is literally git push heroku master
|
# ? Nov 20, 2010 19:16 |
|
Ruby On Rails -- JUST USE HEROKU. gently caress.
|
# ? Nov 20, 2010 20:09 |
|
Pardot posted:Have you tried heroku? It's free to start and deploying is literally git push heroku master Actually I just signed up for a free account to test out some apps, but Im looking around for hosting for a couple clients so Im trying to keep it non nerd friendly incase they decide later down the road that they want to go back to word press or something. edit - theyre tattoo artists, not nerds. And most tattoo artists have assistants (with high turnover) who manage their websites so heroku probably isnt the best choice. They need something cpanel like thats going to do more than RoR rugbert fucked around with this message at 20:32 on Nov 20, 2010 |
# ? Nov 20, 2010 20:17 |
|
rugbert posted:Actually I just signed up for a free account to test out some apps, but Im looking around for hosting for a couple clients so Im trying to keep it non nerd friendly incase they decide later down the road that they want to go back to word press or something. I've had great experience with SpeedyRails. Their support is pretty quick and very responsive.
|
# ? Nov 20, 2010 20:19 |
|
If you want an unmanaged server, rackspace cloud is a good cheap option.
|
# ? Nov 20, 2010 20:21 |
|
I'm creating a site that, among other things, emulates email. For example you can sign in to the site with an email address as your username, create an 'email' (which I called the Item model) and send it to other users on the site via a "to:" field where you would just type in other users' email addresses. Right now I can create and view Items but I'm working on adding in the "to:" field and customizing each user's inbox so that they see only Items addressed to them. How the hell do I do this? I've started by setting up some associations: code:
I'm pretty familiar with PHP/MySQL (used CodeIgniter in the past) so I sort of know what I want to do but I don't know how to do it with Rails.
|
# ? Nov 20, 2010 21:20 |
|
|
# ? Jun 4, 2024 15:08 |
|
You want has_many :through HABTM is mostly for legacy join tables and are pretty fragile. Building many-to-many forms is complex and I recommend [url=github.com/justinfrench/formtastic] Formtastic to take a lot of the pain out of it, at least figuring out how it's supposed to be constructed.
|
# ? Nov 20, 2010 21:46 |