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
Does anyone know of a good tutorial for installing Authlogic in Rails 3? I know how to generate the files and everything, I just keep getting errors.

Has anyone here done this yet?

for reference I followed: http://github.com/binarylogic/authlogic_example

Adbot
ADBOT LOVES YOU

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

Oh My Science
Dec 29, 2008
This was covered a few pages ago, but I cannot find it.

Do you guys have suggestions for hosting, preferably some kind of reseller hosting? I'll have a few client sites going up soon, and I need a host that is rails 3.0 compatible. Possibly a goon hosting solution?

vvv I knew that was going to be the first answer.

Oh My Science fucked around with this message at 20:39 on Mar 8, 2011

Oh My Science
Dec 29, 2008
code:


Installing bcrypt-ruby (2.1.4) /Library/Ruby/Site/1.8/rubygems/installer.rb:574:in `initialize': Permission denied - /Library/Ruby/Gems/1.8/gems/bcrypt-ruby-2.1.4/.gitignore (Errno::EACCES)
	from /Library/Ruby/Site/1.8/rubygems/installer.rb:574:in `open'
	from /Library/Ruby/Site/1.8/rubygems/installer.rb:574:in `extract_files'
	from /Library/Ruby/Site/1.8/rubygems/installer.rb:550:in `each'
	from /Library/Ruby/Site/1.8/rubygems/installer.rb:550:in `extract_files'
	from /Library/Ruby/Site/1.8/rubygems/installer.rb:158:in `install'
	from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/source.rb:96:in `install'
	from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/installer.rb:55:in `run'
	from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each'
	from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each'
	from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/installer.rb:44:in `run'
	from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/installer.rb:8:in `install'
	from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/cli.rb:275:in `update'
	from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/vendor/thor/task.rb:22:in `send'
	from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/vendor/thor/task.rb:22:in `run'
	from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
	from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/vendor/thor.rb:246:in `dispatch'
	from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/vendor/thor/base.rb:389:in `start'
	from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/bin/bundle:13
	from /usr/bin/bundle:19:in `load'
	from /usr/bin/bundle:19
I'm having an issue using devise with a new install of OS X 10.6 + xCode 4. Anyone else encounter this and know of a fix? Google has failed me so far.

Oh My Science
Dec 29, 2008
I'm at my wits end, or maybe I'm too tired.

This is my first time using carrierwave, and for some reason I am having a hell of a time getting lightwindow to work correctly with it. (or any lightbox for that matter)

code:
<%= lightwindow_link_to(
	image_tag(artwork.image_url(:thumb)), artwork.image_url(:large), 
        :title => "This is a test!",
	:author=>"Carlo Bertini",
	:caption=>"Ruby on rails is beautyfull :D",
) %>
I have it all connected properly, however the url returned from artwork.image_url(:large) has a trailing / resulting in a lightwindow with a string in it.

How can I remove the trailing /, or is there a better solution for my lightbox needs?

Edit: Figured it out. The lightwindow plugin must be depreciated.

Oh My Science fucked around with this message at 08:35 on Jun 10, 2011

Oh My Science
Dec 29, 2008

Pardot posted:

mayhaps if you still want to use that plugin.

Thanks, but I decided to go with topup since it seems to have better documentation.

I have a new problem now, and it's about using kaminari for pagination.

My app is basically a simple photo gallery, and although I have pagination working for the gallery index method, I need to limit how many images are displayed using the show method as well.

It looks like this.

code:
class GalleriesController < ApplicationController
  def index
    @galleries = Gallery.page(params[:page]).per(5)
  end

  def show
    @gallery = Gallery.find(params[:id])
  end

.
.
.

end
What do I need to insert into the controller or model in order to limit the number of images found in a gallery?

I can provide more code if necessary.

Oh My Science
Dec 29, 2008
Argh, I still don't get it. Here is some more information, hopefully someone can show me what I am doing wrong.

controller :
code:
class GalleriesController < ApplicationController
  # GET /galleries
  # GET /galleries.json
  def index
    @galleries = Gallery.page(params[:page]).per(4)

    respond_to do |format|
      format.html # index.html.erb
      format.json { render json: @galleries }
    end
  end

  # GET /galleries/1
  # GET /galleries/1.json
  def show
    @gallery = Gallery.find(params[:id])
    @gallery.photos.page(:pagina).per(2)
    
    respond_to do |format|
      format.html # show.html.erb
      format.json { render json: @gallery }
    end
  end
index view:
code:

<% @galleries.each do |gallery| %>
  <tr>
    <td><%= gallery.name %></td>
    <td><%= link_to 'Show', gallery %></td>
    <td><%= link_to 'Edit', edit_gallery_path(gallery) %></td>
    <td><%= link_to 'Destroy', gallery, confirm: 'Are you sure?', method: :delete %></td>
  </tr>
<% end %>
</table>

<%= paginate @galleries %>  <-- THIS WORKS
show view:
code:

<h2>Photos</h2>
<% @gallery.photos.each do |photo| %>
  <p>
    <b>title:</b>
    <%= photo.title %>
  </p>
	<%= image_tag photo.photo_url(:thumb) if photo.photo? %>
<% end %>

<%= paginate @gallery %>  <--- THIS PRODUCES UNDEFINED METHODE 'CURRENT_PAGE'
I recreated a really simple version to just play with this, and I still have no luck. As before I have pagination working on my index view, however I cannot get it working on my show view.

How would I use kaminari to paginate the photos in the show view?

Oh My Science
Dec 29, 2008

Obsurveyor posted:

code:
<%= paginate @gallery.photos %>
perhaps?

Nope, I have tried many variations to no avail.

Edit: loving got it. Thanks for the help.

Oh My Science fucked around with this message at 01:21 on Jun 12, 2011

Oh My Science
Dec 29, 2008

BonzoESC posted:

Did you forget params[:pagina]?

Also, thanks for using Ruby 1.9 :)

Yup I think that was the problem. I wish the documentation was more clear about that.

Oh My Science
Dec 29, 2008
I'm starting to learn about polymorphic associations, and have run into a road block of sorts. So far I have followed and understood the basic concepts presented by ryan baits in episode #154, and have even created the same basic app. I can create new comments, and destroy, however I cannot figure out how to edit them.

I understand that I should be using edit_polymorphic_path or edit_polymorphic_url, and am even 99% sure I am passing in the right models. However when I click the link I get a hash error, which may suggest something is wrong with my controller.

so... does anyone have a working example or know of one that shows a complete polymorphic association in action? My final goal is to create a polymorphic image model with carrierwave, but cannot find many working examples.

Or should I avoid using polymorphic associations all together?

Oh My Science
Dec 29, 2008
I'm running into an issue implementing a simple contact form using this http://www.railsmine.net/2010/03/rails-3-action-mailer-example.html example.

Basically I changed it from support to contact, and although I believe the code is all correct, it will not render the form partial for the contact controller.

What could be causing this?

Oh My Science
Dec 29, 2008
No that is the first thing I look for now, and I noticed the typo in the tutorial. I have however solved my own problem, it only required 6 hours of sleep to track it down.

Thanks for the suggestion.

Oh My Science
Dec 29, 2008
How would I use something like Adapt.js with a rails 3.1 app? The configuration calls for an absolute path to my resources, and there is a probably a better way to do this.

Never mind wrote my own.

Oh My Science fucked around with this message at 07:18 on Jul 22, 2011

Oh My Science
Dec 29, 2008
I know this was answered awhile back, but how can I speed up the load time of a heroku app?

Pretty sure it had something to do with installing new relic to keep your instance running... just wondering if there is another method.

Oh My Science
Dec 29, 2008

A MIRACLE posted:

Are you on a free account? They'll spin your dyno down if there's no activity for a few minutes.

Yes I am currently using a free account, and am willing to spend money to keep it running. I am / was under the impression that adding a dyno or worker would not prevent the instance from dropping.

Damnit I was going through the documentation and didn't find that. Thanks VVV

Oh My Science fucked around with this message at 18:47 on Aug 30, 2011

Oh My Science
Dec 29, 2008
I'll be looking at adding a cart to an existing clients site, and I would appreciate some feed back regarding spree. If I need a highly customized look, is spree simple enough to bend to my will? I took a look at the documentation, and they recommended against replacing the entire theme manually due to issues caused by future upgrades.

Also, is there anything else I should be looking at in terms of rails e-commerce. Spree seems to offer what the client wants, but I am eager to learn how to do this myself. Considering time is not an issue, are there some good (current) resources regarding creating your own simple(?) carts?

To clarify this is for an artists site, and all they really want to do is sell prints from their online portfolio. Ideally it would be nice to have the option of adding pieces to a store when they are uploaded to the portfolio, and define print size, prices, etc. all at the same time.

I need to be schooled in e-commerce please.

Oh My Science
Dec 29, 2008
I'm playing around with sorting a list of products, and need some help.

After following Ryan Bates HABTM tutorial I now have products that can belong to a number of categories. I now want to filter products by their category specified by the user.

Can someone give me an example or hints on how to do this?

Oh My Science
Dec 29, 2008

Pardot posted:

You should buy somethingawful platinum so I can PM you and hook you up with beta access to things.

If I already have platinum can I have access to these beta things?

My Setup:

- RVM, ruby 1.9.3 (switching to rbenv eventually)
- Textmate
- iTerm2
- Heroku
- postgres
- git

Oh My Science
Dec 29, 2008
I understand the appeal of having an all-in-one app to setup my rails enviroment, it just doesnt seem neccessary with tools like brew, bundler and rbenv. Just last night I made the switch to rbenv after a system format and it only took me 10-15 minutes to be up and running again. Has the setup process become too difficult for developers to handle?

Just to be clear, is he trying to make a RoR GUI editor as well? Or just a tool to manage your gems and ruby installs?

Oh My Science
Dec 29, 2008
When using postgresql in a new app it won't allow me to connect unless I specify a host:

code:
database.yml

development:
  adapter: postgresql
  encoding: unicode
  database: ***
  pool: 5
  host: localhost  <--
  username: ***
  password: ***
Using my previous setup I never had to include that option, what happened?


Edit: It was a pathing issue. Once I corrected the path in .bash_profile and reinstalled the pg gem it is working as expected again.

What's really bothering me is the inability to play with Rails Apps Composer, since the active record recipe doesn't allow me to provide the username / password / host options. It simply tries using the default rails database.yml, which results in the script being unable to access the db.

While I'm at it, how do people feel about Rails Apps Composer, or Rails Wizard? Are they a good idea to use for basic app templates? Or would you rather stick to the manual approach of setting up a new app?

Oh My Science fucked around with this message at 19:02 on Apr 9, 2012

Oh My Science
Dec 29, 2008

enki42 posted:

Related question to Heroku spinning down - how does this work on the Cedar stack? If I have 1 web dyno and 1 worker dyno, is it possible for that web dyno to spin down (i.e. do I need to have at least 2?)

I am fairly certain it does not count workers towards spin down, and that yes, at least two dinos are needed.

Oh My Science
Dec 29, 2008
I'm afraid I don't really know how to ask for this properly, but here it goes.

I would like to provide users with the ability to use different view layouts based on their user settings, what would be the best way to accomplish this? ( similar to what Facebook & twitter has done recently )

So far my google-fu has not produced many results, and after reading the API on layouts and templates I feel I may be missing something fundamental.

Oh My Science
Dec 29, 2008

prom candy posted:

The themes_for_rails gem might be interesting to you as well.

This is exactly what I wanted, thank you!

Oh My Science
Dec 29, 2008
Care to elaborate on that point? I haven't read the documentation yet, but if you can provide advice based on your hiccups it may save me some time.

What was the proper folder structure?

Oh My Science
Dec 29, 2008

Anyone know how to manually install compass in a rails app?

I want to mess around with Susy 1.0.rc.0 but it requires the alpha compass release v0.13.alpha.0. unfortunately they stripped regular compass of its rails integration starting in v0.12, and instead rely on compass-rails, which has not updated to the alpha release.

Any ideas? I keep getting this error:

File to import not found or unreadable: susy


Never mind, found a release candidate of compass rails.

Oh My Science fucked around with this message at 04:19 on May 22, 2012

Oh My Science
Dec 29, 2008
I find myself wanting to Learn more about ruby, has anyone taken the ruby course from pragmatic studio? I could probably grab a book or two, but I'm partial to video tutorials.

Oh My Science
Dec 29, 2008

Dangerllama posted:

You might also check out Coursera's SaaS class. It's the free on-line version of UC Berkeley's SaaS course, and covers Ruby, Rails, test-driven development, and a couple of other things over six weeks.

I didn't speak Ruby before I took it and thought it was a pretty good introduction to the language, and rails.

Thanks for this, ill be sure to check it out next. I ponied up for the pragmatic course and although it's not challenging me, I am relearning some basic fundamentals.

Oh My Science
Dec 29, 2008

Pardot posted:

If you want to step it up a bunch, go from using LIKE to great built-in fulltext search. Pivotal released a gem that makes using the tsvector stuff easy with rails: https://github.com/casecommons/pg_search

This is awesome.

Oh My Science
Dec 29, 2008
I started learning rails & ruby at the same time, so it's possible. A few months back I decided to focus more so on ruby in order to better understand what rails does, and I have to say it makes my life easier.

I signed up for the pragmatic online ruby course, which proved to be a decent resource. At this point I would like to dig deeper, not sure where I should look though.

Oh My Science
Dec 29, 2008
Why learn with Hobo? I remember running into it when I first started as well, but I decided to learn RoR with just RoR, no fancy additions. Does Hobo offer something I am not aware of? Is it used in a lot of production apps (their gallery is pretty sparse)?

Oh My Science
Dec 29, 2008

Knyteguy posted:

On a side note, I did try Heroku. It really seems like more of a headache than setting up my server in this manner...

I'm really interested to know why you think this. I've used Heroku for a little while now, and set-up is nearly painless. My only complaint is the price associated with it. The bare minimum (after the free tier) is $35.00 a month + whatever add-ons you want to use.

I have recently experimented with a VPS or two, and although I got it running properly, it took time (which could have been spent working on the app). At this point I'm comfortable setting up a new server with rvm-capybara + nginx + unicorn, but my god was the documentation to do so fragmented. The cost however is much lower.

Oh My Science
Dec 29, 2008
Is there an alternative for Mercury Editor? I think this is over kill for what I want to do. I just want to provide some buttons for users to markup a blog post. Or am I better off creating my own with red carpet?

Oh My Science
Dec 29, 2008
I'm looking for an appointment booking gem or engine. I feel that something like this should already exist, but all I can find is https://github.com/Leveton/appointments which is poorly documented & tested.

Should I maybe look at an external service which offers an API?

Oh My Science
Dec 29, 2008

Fillerbunny posted:

I have sort of a generic question about modelling a database. Is there any sort of rule of thumb about using STI versus polymorphic relationships?

If you have a railscast account Ryan just posted an episode on this very subject. I'll give it a watch and get back to you.

STI and Polymorphic Associations

Oh My Science
Dec 29, 2008

Fillerbunny posted:

I don't have a pro account, sadly. That sounds like it's right up my alley.

Everything I've read so far says to avoid STI. My gut is telling me to avoid STI. The only thing holding me back from using polymorphic associations is, "I don't get it."

Ryan has a revised polymorphic episode, Polymorphic Association (revised), which may give you some insight. It's free.

poo poo never mind, forgot revised episodes cost $$ too. sorry.

Oh My Science fucked around with this message at 21:44 on Nov 26, 2012

Oh My Science
Dec 29, 2008

The Sweetling posted:

Jumping on the tutorial bandwagon here: please recommend some good resources for brushing up on my PostgeSQL. I haven't had the need to write complex queries in ages and feel a bit rusty.

Ryan Bates has some fairly recent screencasts covering PostgreSQL & its features. Most of the good ones are "subscription only" though, and you'll have to cough up $9 to view them.

I found this http://www.postgresqltutorial.com/.

Oh My Science
Dec 29, 2008
Maybe I'm reading into this incorrectly but does the cedar stack use intelligent routing instead of random?

Also, as someone who spent the last year digging into rails 3.x is the focus in 4.x now multi threaded apps? It seems to be that way with the introduction of live streaming & thread-safety enabled by default.

Oh My Science
Dec 29, 2008
I'm having one hell of a time getting a rails 4 test app running on Heroku, maybe someone here can help me out.

At the moment I think it has something to do with precompiling the assets. I have dug through the docs & googled it to death, but no solutions yet. Of course on my local machine it works great... I can run rake assets:precompile just fine, and so can heroku if I choose not to do it locally. I just keep getting 404's for my js & css.

Could this possibly have something to do with the browser gem?


Found the dev article for rails 4

Oh My Science fucked around with this message at 17:56 on Mar 30, 2013

Oh My Science
Dec 29, 2008
Check out http://www.codelearn.org/rails-tutorials

It lets you learn basic rails without having to setup a dev environment locally.

Adbot
ADBOT LOVES YOU

Oh My Science
Dec 29, 2008
I was just going to recommend vagrant as well. Having a standardized environment for students and instructor could potentially save you a lot of pain.

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