|
I am about at my breaking point with using Devise. I got everything working today with my legacy database and datamapper. I am using my mongodb as the session store but now my spork server stuff is completely broken. database.yml is not being loaded under spork, everything works fine in 'rails server' and 'rails console'. I cannot figure out why it is doing this. None of this is really Devise's fault but it has been super frustrating dealing with it and its lack of documentation. There does not seem to be anywhere where all the callback hooks are documented in one place. Most of the documentation a step away from using the generators is really vague or really, really specific and ends up not being very helpful. I hate all the magic that happens in devise_for. At this point, I am really tempted to just roll my own based on the Ruby on Rails Tutorial and the railscast that is out there and maybe trying to integrate warden into that. Other than fixing spork, the last thing I need to get working is making it so a user can only be logged in on a single session. There does not seem to be any support for this kind of thing built-in to Devise, which is really strange to me because it seems like it would be an important feature. I am hoping there is a hook in Devise for post-login, before the redirect, but I cannot find it if there is. Obsurveyor fucked around with this message at 22:54 on Mar 16, 2011 |
# ? Mar 16, 2011 22:51 |
|
|
# ? May 14, 2024 14:32 |
I'm a rails noob working through a tutorial. I added a CSS layout to my template and now the method buttons like "Show", "Edit" etc include a path, like "Show /bugs/field_samples/3". I was wondering if there was something in the CSS that could cause it to change like that. The CSS is "Blueprint" if that matters.
|
|
# ? Mar 17, 2011 01:55 |
|
A MIRACLE posted:I'm a rails noob working through a tutorial. I added a CSS layout to my template and now the method buttons like "Show", "Edit" etc include a path, like "Show /bugs/field_samples/3". That code is on the button itself? Do a pastebin or put the code in your post so we can see, and maybe a screenshot of the actual app. This tutorial does a few things like buttons with Blueprint - http://ruby.railstutorial.org/ruby-on-rails-tutorial-book
|
# ? Mar 17, 2011 02:18 |
here's the code:code:
|
|
# ? Mar 17, 2011 02:59 |
|
Looks like you loaded the blueprint print stylesheet and not the screen stylesheet.
|
# ? Mar 17, 2011 03:17 |
atastypie posted:Looks like you loaded the blueprint print stylesheet and not the screen stylesheet. Thanks. Is there a reason the changes I make on a views/ file take some time to propagate (as opposed to showing the results instantly)?
|
|
# ? Mar 17, 2011 03:35 |
|
Obsurveyor posted:I am about at my breaking point with using Devise. You might not want to hear this, but ripping Devise out of a project that used it was one of the best things I've ever done for productivity.
|
# ? Mar 17, 2011 06:41 |
|
A MIRACLE posted:Thanks. Is there a reason the changes I make on a views/ file take some time to propagate (as opposed to showing the results instantly)? Are you editing on the live server running in production mode? If so, don't do that; edit locally in development mode, use version control, and a deployment tool. PHP amateur hour poo poo doesn't fly in Rails.
|
# ? Mar 17, 2011 06:42 |
|
Just a heads up that the MountainWest Ruby Conference is livestreaming: http://mtnwestrubyconf.org/
|
# ? Mar 17, 2011 18:03 |
|
BonzoESC posted:You might not want to hear this, but ripping Devise out of a project that used it was one of the best things I've ever done for productivity. Dumbest thing I found today in my code: code:
|
# ? Mar 17, 2011 23:12 |
|
Anveo posted:Any specific reason you can't just use a tempfile? Thanks for this. I tried out a tempfile before and wasn't able to get it to work. No dice this time either. I think the problem is that the tempfile is being created correctly, but simple_xlsx_writer likes to make a whole mess of temp files in the same directory as the specified file and it isn't able to. Either way I was getting some bizarre zip header errors. I ended up creating a temp directory in my rails public folder, creating a file for export, writing the xlsx and streaming it with send_file, then using FileUtils to manually delete it afterwards. Its a kludge but it works.
|
# ? Mar 18, 2011 18:34 |
|
8ender posted:I ended up creating a temp directory in my rails public folder, creating a file for export, writing the xlsx and streaming it with send_file, then using FileUtils to manually delete it afterwards. Its a kludge but it works. If you're using send_file, you probably don't need to put it in $APP/public/, you could get away with $APP/tmp or /tmp/application_name. If generating the xlsx is a slow task and you're not on Heroku or Windows, I'd probably use resque to move the xlsx generation out of the web request.
|
# ? Mar 18, 2011 18:51 |
|
BonzoESC posted:If you're using send_file, you probably don't need to put it in $APP/public/, you could get away with $APP/tmp or /tmp/application_name. Actually the best part of simple_xlsx_writer is that its really drat fast. I tried it out with a 800 row spreadsheet and while it put some heat on the database the actual spreadsheet generation was quick. Either way its quick enough for a web request right now. Edit: Forgot to say thanks for the link to Resque. Looks great and I'm already thinking of a few things I can offload.
|
# ? Mar 18, 2011 19:13 |
|
code:
|
# ? Mar 20, 2011 21:50 |
|
The Rails Thread: USE RVM AND HEROKU. gently caress. The first applies to you.
|
# ? Mar 20, 2011 22:58 |
|
So whats some good e-commerce gems? Im looking at spreecommerce and that looks OK I guess. Ive never worked with selling poo poo from a website other than using paypal so this is a first.NotShadowStar posted:The Rails Thread: USE RVM AND HEROKU. gently caress. Can you use multiple accounts on heroku from the same computer? I dont like the idea of hosting a bunch of client sites on my heroku account. Sometimes I want to just push it off on them after Im done building so I dont have to deal with them anymore.
|
# ? Mar 22, 2011 23:05 |
|
rugbert posted:So whats some good e-commerce gems? Im looking at spreecommerce and that looks OK I guess. Ive never worked with selling poo poo from a website other than using paypal so this is a first. Spree is a whole storefront package in Rails, but if you just need to deal with processing payments Active Merchant is probably what you want.
|
# ? Mar 22, 2011 23:54 |
|
rugbert posted:Can you use multiple accounts on heroku from the same computer? I dont like the idea of hosting a bunch of client sites on my heroku account. Sometimes I want to just push it off on them after Im done building so I dont have to deal with them anymore. Make a new account for the client site, grant your account permissions. As part of the client handoff, make sure they log in, change and document the credentials, and remove your permissions.
|
# ? Mar 23, 2011 01:46 |
|
Anveo posted:Spree is a whole storefront package in Rails, but if you just need to deal with processing payments Active Merchant is probably what you want. I mean, I guess having a shopping cart is a good idea. Ive never even attempted to build one. Is there a good tutorial out there to help me out? I just got 2 jobs that want e-commerce.
|
# ? Mar 26, 2011 01:43 |
|
My recommendation is to identify who provides the merchant accounts and use the hosted payment pages offered by those companies. ActiveMerchant will let you integrate with responses back to your server. Do not under and circumstances have a user enter credit card information on your server. Read up on PCI and make sure you understand it. Figuring the rest out is all pretty easy in rails. Bare minimum for a shopping cart is probably Products, Carts, Cart Items, Orders, Order Items. If you're not sure where to start, you might be better off subcontracting. Or just use Spree. It's awesome. hmm yes fucked around with this message at 02:45 on Mar 26, 2011 |
# ? Mar 26, 2011 02:04 |
|
Does anyone understand how before_filters work in Rails 3? I have been struggling with trying to secure js/json access to my app using the auth filters I already have setup to avoid code duplication. before_filter is supposed to be an alias for append_before_filter which implies that it is not messing with filters created beforehand, thus the word "append". However, if you do something like:code:
This seems broken to me.
|
# ? Mar 26, 2011 15:29 |
|
Obsurveyor posted:Does anyone understand how before_filters work in Rails 3? I have been struggling with trying to secure js/json access to my app using the auth filters I already have setup to avoid code duplication. before_filter is supposed to be an alias for append_before_filter which implies that it is not messing with filters created beforehand, thus the word "append". However, if you do something like: Why are you trying to run the same before_filter multiple times? code:
|
# ? Mar 26, 2011 16:18 |
|
BonzoESC posted:Make a new account for the client site, grant your account permissions. As part of the client handoff, make sure they log in, change and document the credentials, and remove your permissions. Ok I made a new account to test this out. Where can I grant my account permissions? I guess what I need to do is create an app on the new account, and then give my account the ability to collaborate? Is there a way to do that from my computer? Because my computer is tied to my account, should I use a VM?
|
# ? Mar 26, 2011 20:30 |
|
BonzoESC posted:Why are you trying to run the same before_filter multiple times? code:
I ended up just making a new filter just for :list that does the right thing, even if it does duplicate code. On a related note: Is there any way to make Rails render a 404 for formats that are not supported instead of a 500 and throwing an ActionView::MissingTemplate? I really do not want to add a respond_to block to do it for every action for every format I do not care about supporting.
|
# ? Mar 26, 2011 21:05 |
|
Obsurveyor posted:The actual filter would not run multiple times in a real scenario, that was just to show the Rails behavior. This is exactly what I wanted to do earlier: But answering the question you asked instead of the question you should be asking, this is passable I guess: code:
|
# ? Mar 26, 2011 23:14 |
|
rugbert posted:Ok I made a new account to test this out. Where can I grant my account permissions? I guess what I need to do is create an app on the new account, and then give my account the ability to collaborate? Is there a way to do that from my computer? Because my computer is tied to my account, should I use a VM? code:
|
# ? Mar 26, 2011 23:44 |
|
BonzoESC posted:From the command-line heroku tool: ahh awesome. sharing:transfer saves the day! thanks!
|
# ? Mar 27, 2011 16:44 |
|
EDIT: Wheeee, turns out that "resource" and "resources" gives you different routes.
FamDav fucked around with this message at 01:28 on Mar 30, 2011 |
# ? Mar 29, 2011 05:58 |
|
Looks like watermarking doesnt work with paperclip in rails3. Anyone have an easy way to watermark photos on upload? edit - wait, looks like I cant put this somewhere in paperclip: https://gist.github.com/708077 Im not sure where to put it tho. rugbert fucked around with this message at 21:07 on Mar 29, 2011 |
# ? Mar 29, 2011 20:32 |
|
Why wouldn't it work? You can use any Imagemagick option on any different type of file that Paperclip supports. I don't have it here but this should work: code:
http://www.imagemagick.org/Usage/annotating/#watermarking
|
# ? Mar 29, 2011 21:07 |
|
NotShadowStar posted:Why wouldn't it work? Apparently there was a watermark feature: quote::processors => [:watermark], Im trying this: quote::convert_options => [:watermarked =>"-dissolve 25% -gravity south #{RAILS_ROOT}/public/images/watermark.png"] but Im getting a TypeError: "Symbol as array index"
|
# ? Mar 29, 2011 21:49 |
|
rugbert posted:but Im getting a TypeError: "Symbol as array index" Hash{} not Array[] for :convert_options.
|
# ? Mar 29, 2011 22:06 |
|
Anveo posted:Hash{} not Array[] for :convert_options. DOH! Duh, I really need new glasses! Ok, I tried this: :convert_options => {:blog =>"-dissolve 25% -gravity south #{RAILS_ROOT}/public/images/watermark.png"} but Im getting a paperclip error in the console: PaperclipError: There was an error processing the thumbnail for stream I guess Im not passing something in correctly or leaving something out? The imagemagick documentation looks like it gets the watermark, original image, and watermarked image passed in. rugbert fucked around with this message at 23:58 on Mar 29, 2011 |
# ? Mar 29, 2011 22:15 |
|
I'm writing a simple app that allows you to input a text message and you get back a random code number so you can retrieve the text message later. I have a Message model with two columns: contents codeNumber I would like the app to generate a unique codeNumber and save it to the database along with the message contents. If I go into the console and do code:
If I do: code:
What am I doing wrong? My Message model: __________ class Message < ActiveRecord::Base def codeNumber generateCode end private def generateCode Code Logic in here end end ____________ EDIT: I may have found a solution, but it may not be elegant. Please look below. I revised my Model to institute a callback. This still seems wrong, but it works. code:
plasticbugs fucked around with this message at 08:14 on Mar 30, 2011 |
# ? Mar 30, 2011 07:51 |
|
Yeah, you're on the right track, but this is probably what closer to what you wantcode:
Pardot fucked around with this message at 08:30 on Mar 30, 2011 |
# ? Mar 30, 2011 08:26 |
|
Pardot posted:Yeah, you're on the right track, but this is probably what closer to what you wan Thanks for your help! I'm reading up on memoization right now.
|
# ? Mar 30, 2011 08:56 |
|
plasticbugs posted:Thanks for your help! I'm reading up on memoization right now. If you're on Rails 3 (or are otherwise pulling in activesupport 3), you can get a bunch of exrta tools (cache flushing, priming, for free by using the Memoizable module: code:
|
# ? Mar 30, 2011 18:51 |
|
Anyone know how to prevent helpers from being cached? Even a fresh rails app will cache helpers for me in development mode, forcing me to restart in order to reload changes.
|
# ? Mar 30, 2011 22:15 |
|
Anyone know how to tell capistrano: "I want to ssh into the target machine as userX but then I want you to execute all commands as userY via sudo"?
|
# ? Mar 30, 2011 22:37 |
|
|
# ? May 14, 2024 14:32 |
|
Is something going on with heroku? Im testing an site on it that works fine on my PC but breaks on heroku and heroku logs isnt giving me anything. Heroku logs is just showing me GET requests instead of errors now edit - I re pushed and it seems to be working again. rugbert fucked around with this message at 23:23 on Mar 31, 2011 |
# ? Mar 31, 2011 23:20 |