Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Oh My Science
Dec 29, 2008
I've begun using devise with omniauth and I cannot get my localhost machine recognized by my facebook app settings. The error message I get is:

"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

Adbot
ADBOT LOVES YOU

rugbert
Mar 26, 2003
yea, fuck you
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.

IsotopeOrange
Jan 28, 2003

I'm getting a strange warning that I can't figure out with my google-fu:
code:
$ rake
/home/IsotopeOrange/.rvm/gems/ruby-1.9.2-p0/gems/json_pure-1.4.6/lib/json/common.rb:65: warning: already initialized constant State
/home/IsotopeOrange/.rvm/gems/ruby-1.9.2-p0/gems/json_pure-1.4.6/lib/json/common.rb:66: warning: already initialized constant SAFE_STATE_PROTOTYPE
/home/IsotopeOrange/.rvm/gems/ruby-1.9.2-p0/gems/json_pure-1.4.6/lib/json/common.rb:67: warning: already initialized constant FAST_STATE_PROTOTYPE
/home/IsotopeOrange/.rvm/gems/ruby-1.9.2-p0/gems/json_pure-1.4.6/lib/json/common.rb:74: warning: already initialized constant PRETTY_STATE_PROTOTYPE
/home/IsotopeOrange/.rvm/gems/ruby-1.9.2-p0/gems/json_pure-1.4.6/lib/json/ext.rb:14: warning: already initialized constant JSON_LOADED
My stack is: Ubuntu 10.10, rvm, ruby-1.9.2, rails-3.0.1
It's just a warning, but any thoughts on what could be causing it?

BrokenDynasty
Dec 25, 2003

rugbert posted:

How do I use one of my layouts for devise? I already ran


and it moved all the devise views for me, but it didnt create a controller for me to to use my layout.

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.

Pardot
Jul 25, 2001




IsotopeOrange posted:

I'm getting a strange warning that I can't figure out with my google-fu:
code:
$ rake
/home/IsotopeOrange/.rvm/gems/ruby-1.9.2-p0/gems/json_pure-1.4.6/lib/json/common.rb:65: warning: already initialized constant State
/home/IsotopeOrange/.rvm/gems/ruby-1.9.2-p0/gems/json_pure-1.4.6/lib/json/common.rb:66: warning: already initialized constant SAFE_STATE_PROTOTYPE
/home/IsotopeOrange/.rvm/gems/ruby-1.9.2-p0/gems/json_pure-1.4.6/lib/json/common.rb:67: warning: already initialized constant FAST_STATE_PROTOTYPE
/home/IsotopeOrange/.rvm/gems/ruby-1.9.2-p0/gems/json_pure-1.4.6/lib/json/common.rb:74: warning: already initialized constant PRETTY_STATE_PROTOTYPE
/home/IsotopeOrange/.rvm/gems/ruby-1.9.2-p0/gems/json_pure-1.4.6/lib/json/ext.rb:14: warning: already initialized constant JSON_LOADED
My stack is: Ubuntu 10.10, rvm, ruby-1.9.2, rails-3.0.1
It's just a warning, but any thoughts on what could be causing it?

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…

rugbert
Mar 26, 2003
yea, fuck you

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.

SamMalone
Aug 3, 2006
I'm always smoking!
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:
<script type="text/javascript">

  Hotkeys.bind("alt+a", alert("what"));

</script>
The problem is that the code that should execute when the key combo is pressed just executes immediately when the page is loaded, and then doesn't react to the key binding after that. I thought it might be something to do with where I put the script, or my syntax. The strange thing is that it seems to work sometimes, although I haven't been able to isolate any working circumstances. The prototype-hotkeys that I downloaded doesn't mention any bugs - I can't find anyone with the same problem, so I don't think it's a problem with that code. Does anyone have any idea what I might be doing wrong?


In general, what are some other alternatives for binding keys to link navigation and other functions, like scope navigation?

NotShadowStar
Sep 20, 2000

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.

code:
<script type="text/javascript">

  Hotkeys.bind("alt+a", alert("what"));

</script>
The problem is that the code that should execute when the key combo is pressed just executes immediately when the page is loaded, and then doesn't react to the key binding after that. I thought it might be something to do with where I put the script, or my syntax. The strange thing is that it seems to work sometimes, although I haven't been able to isolate any working circumstances. The prototype-hotkeys that I downloaded doesn't mention any bugs - I can't find anyone with the same problem, so I don't think it's a problem with that code. Does anyone have any idea what I might be doing wrong?


In general, what are some other alternatives for binding keys to link navigation and other functions, like scope navigation?

You need to put bindings in an document load function, or the Javascript just executes line by line.
code:
Event.observe("dom:loaded", function () {
  Hotkeys.bind("alt+a", alert("what"));
}

rugbert
Mar 26, 2003
yea, fuck you
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
code:
 <%= link_to "Delete", admin_image_path(i), :method => :delete, :confirm =>"Are you sure?" %>
gives me a routing error, "No route matches /admin/images/2". What gives?

NotShadowStar
Sep 20, 2000
Post 'rake routes'

IsotopeOrange
Jan 28, 2003

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
code:
 <%= link_to "Delete", admin_image_path(i), :method => :delete, :confirm =>"Are you sure?" %>
gives me a routing error, "No route matches /admin/images/2". What gives?

Do you have something like this in your config/routes.rb ?
code:
scope "admin" do
  resources :images
end

rugbert
Mar 26, 2003
yea, fuck you
Here are the routes for the images section:
code:
               admin_images GET    /admin/images(.:format)                      {:controller=>"admin/images", :action=>"index"}
                admin_images POST   /admin/images(.:format)                      {:controller=>"admin/images", :action=>"create"}
             new_admin_image GET    /admin/images/new(.:format)                  {:controller=>"admin/images", :action=>"new"}
            edit_admin_image GET    /admin/images/:id/edit(.:format)             {:controller=>"admin/images", :action=>"edit"}
                 admin_image PUT    /admin/images/:id(.:format)                  {:controller=>"admin/images", :action=>"update"}
                 admin_image DELETE /admin/images/:id(.:format)                  {:controller=>"admin/images", :action=>"destroy"}

And in my routes file I have
code:
  namespace :admin do
      resources :images, :except => show
  end

rugbert
Mar 26, 2003
yea, fuck you

rugbert posted:

Here are the routes for the images section:
code:
               admin_images GET    /admin/images(.:format)                      {:controller=>"admin/images", :action=>"index"}
                admin_images POST   /admin/images(.:format)                      {:controller=>"admin/images", :action=>"create"}
             new_admin_image GET    /admin/images/new(.:format)                  {:controller=>"admin/images", :action=>"new"}
            edit_admin_image GET    /admin/images/:id/edit(.:format)             {:controller=>"admin/images", :action=>"edit"}
                 admin_image PUT    /admin/images/:id(.:format)                  {:controller=>"admin/images", :action=>"update"}
                 admin_image DELETE /admin/images/:id(.:format)                  {:controller=>"admin/images", :action=>"destroy"}

So my link_to is right, right?

And in my routes file I have
code:
  namespace :admin do
      resources :images, :except => show
  end

IsotopeOrange
Jan 28, 2003

rugbert posted:

Here are the routes for the images section:
code:
               admin_images GET    /admin/images(.:format)                      {:controller=>"admin/images", :action=>"index"}
                admin_images POST   /admin/images(.:format)                      {:controller=>"admin/images", :action=>"create"}
             new_admin_image GET    /admin/images/new(.:format)                  {:controller=>"admin/images", :action=>"new"}
            edit_admin_image GET    /admin/images/:id/edit(.:format)             {:controller=>"admin/images", :action=>"edit"}
                 admin_image PUT    /admin/images/:id(.:format)                  {:controller=>"admin/images", :action=>"update"}
                 admin_image DELETE /admin/images/:id(.:format)                  {:controller=>"admin/images", :action=>"destroy"}

And in my routes file I have
code:
  namespace :admin do
      resources :images, :except => show
  end

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

skidooer
Aug 6, 2001

rugbert posted:

And in my routes file I have
code:
  namespace :admin do
      resources :images, :except => show
  end
Remove the :except parameter. The route you are trying to reach is the show action.

rugbert
Mar 26, 2003
yea, fuck you

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

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.

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

Pardot
Jul 25, 2001




rugbert posted:

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?

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.

dizzywhip
Dec 23, 2005

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.

code:
<script type="text/javascript">

  Hotkeys.bind("alt+a", alert("what"));

</script>
The problem is that the code that should execute when the key combo is pressed just executes immediately when the page is loaded, and then doesn't react to the key binding after that. I thought it might be something to do with where I put the script, or my syntax. The strange thing is that it seems to work sometimes, although I haven't been able to isolate any working circumstances. The prototype-hotkeys that I downloaded doesn't mention any bugs - I can't find anyone with the same problem, so I don't think it's a problem with that code. Does anyone have any idea what I might be doing wrong?


In general, what are some other alternatives for binding keys to link navigation and other functions, like scope navigation?

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:
Hotkeys.bind("alt+a", function() {
  alert("what");
});

rugbert
Mar 26, 2003
yea, fuck you

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.

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.

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

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
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:
Rendered content/recent.haml within layouts/application (1080.1ms)
Completed 200 OK in 1517ms (Views: 1124.4ms | ActiveRecord: 15.2ms)
:ohdear:

8ender
Sep 24, 2003

clown is watching you sleep

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.

NotShadowStar
Sep 20, 2000

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.

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:
Rendered content/recent.haml within layouts/application (1080.1ms)
Completed 200 OK in 1517ms (Views: 1124.4ms | ActiveRecord: 15.2ms)
:ohdear:

-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.

8ender
Sep 24, 2003

clown is watching you sleep

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?

NotShadowStar
Sep 20, 2000

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.

May I ask, have you gone through porting a 2.3.x app to 3.x? How was it? Were the changes required significant?

http://blog.shopify.com/2010/11/16/our-upgrade-to-rails-3

Anveo
Mar 23, 2002

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.

8ender
Sep 24, 2003

clown is watching you sleep

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.

NotShadowStar
Sep 20, 2000
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.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

8ender posted:

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.

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.

8ender
Sep 24, 2003

clown is watching you sleep

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.

Anveo
Mar 23, 2002

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.

rugbert
Mar 26, 2003
yea, fuck you

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.

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.

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?

dizzywhip
Dec 23, 2005

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.

For future reference, what if I do need some jquery magic?

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.

rugbert
Mar 26, 2003
yea, fuck you

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.

Pardot
Jul 25, 2001




rugbert posted:

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.

Have you tried heroku? It's free to start and deploying is literally git push heroku master

NotShadowStar
Sep 20, 2000
Ruby On Rails -- JUST USE HEROKU. gently caress.

rugbert
Mar 26, 2003
yea, fuck you

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

BrokenDynasty
Dec 25, 2003

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.

Cock Democracy
Jan 1, 2003

Now that is the finest piece of chilean sea bass I have ever smelled
If you want an unmanaged server, rackspace cloud is a good cheap option.

Tomed2000
Jun 24, 2002

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:
class Item < ActiveRecord::Base
  has_and_belongs_to_many :users
end

class User < ActiveRecord::Base
  has_and_belongs_to_many :items
end
I'm not really sure where to go from here. I figured I'd start by modifying the _form.html.erb for Item to add in the "to:" field but that's where I'm stuck.

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.

Adbot
ADBOT LOVES YOU

NotShadowStar
Sep 20, 2000
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.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply