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
A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

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.

Adbot
ADBOT LOVES YOU

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

here's the code:
code:
<h1>Listing Field Samples</h1>
<b>Hello!</b>
<table>
  <tr>
    <th>Name</th>
    <th>Latitude</th>
    <th>Longitude</th>
  </tr>

<% @field_samples.each do |field_sample| %>
  <tr>
    <td><%=h field_sample.name %></td>
    <td><%=h field_sample.latitude %></td>
    <td><%=h field_sample.longitude %></td>
    <td><%= link_to 'Show', field_sample %></td>
    <td><%= link_to 'Edit', edit_field_sample_path(field_sample) %></td>
    <td><%= link_to 'Destroy', field_sample, :confirm => 'Are you sure?', :method => :delete %></td>
  </tr>
<% end %>
</table>

<br />

<%= link_to 'New field_sample', new_field_sample_path %>
here's a screenshot:

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

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)?

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

.

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

Has anyone here used http://refinerycms.com/ ? I'm in charge of picking a CMS for our custom development projects. The main requirement is that it can be configured to pull xml feeds from our main servers to populate things like Upcoming Event widgets.

We're an events-based calendar software company at heart, and some of our customers want websites to go along with the main product. So far we've been one-offing everything in .NET2.0, reusing controls that feed on our xml streams. But it's time-intensive and the developer (me) has to put everything together, which distracts from the main product. If we had a cms then the support/marketing/design side could take some of the burden off the developers.

My boss suggested modx, which looks decent, but PHP makes me queasy and I'm looking for alternatives.

Simbyotic posted:


sounds like you're using rails 2. "rails new" is a rails 3 command. "rails /path/to/myapp/" is the rails 2 command. type "rails -v" to see what's up.

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

Doing a project in rails for work. I have all these .ind files in a tmp directory, do those need to be in version control? My office uses SVN :( Should I be using git instead?

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

I think SASS is pretty neat. But do I have to leave the Sass CLI listener open and watching my .scss files for diffs, or can the interpreter just use them un-converted by virtue of having the .scss extension? Windows dev here.

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

Pardot posted:

I don't understand the appeal of scss. Sass is great though.

I like it a little better. I'm weird and like braces and semicolons though.
code:
@mixin shadow($x, $y, $b, $color: $dark-gray) {
  -moz-box-shadow:$x $y $b $color;
  -webkit-box-shadow:$x $y $b $color;
  -o-box-shadow:$x $y $b $color;
  box-shadow:$x $y $b $color;
}

div {
  @include shadow(0px, 5px, 20px);
}

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

Bob Morales posted:

Gotcha. In this particular case they'd want ALL the evaluations for the promotion so I'm not sure why they would put 0-99. Ugh.

99 is a pretty big number they'd probably never need to go higher than that.

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

Rails noob here. Is there a "cleaner," less bulky way of extracting inner text XML with Nokogiri? Feel free to make fun of my awful code.
code:
xml_file = Nokogiri::XML(OpenURI::OpenRead("my_url"))
events = xml_file.xpath("//event")

events.each do |e|
  puts "Creating " + (e>"event_name").text + "..."
  # get the date (for readability)
  date_range = e>"date_range"
  start_date = DateTime.parse( (date_range>"start_date").text + 
                               (date_range>"start_time").text )
  end_date = DateTime.parse( (date_range>"end_date").text +
                             (date_range>"end_time").text )


  Event.create(
    :title => (e>"event_name").text,
    :unique_event_id => (e>"unique_event_id").text.to_i,
    :description => (e>"description").text ,
    :start_at => start_date,
    :end_at => end_date )
end

A MIRACLE fucked around with this message at 22:08 on Aug 22, 2011

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

What are the differences between these?
code:
<% ... %>
# and
<% ... -%>

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

Oh My Science posted:

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.

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

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

looked it up. heroku has pretty extensive documentation.

heroku dev center posted:

What is dyno idling?
Apps that have only 1 web dyno will be idled out after a period of inactivity. The web dyno will be shut down. When a request comes in to an idled app your web dyno will be automatically spun back up, causing a few second delay for this first request. Subsequent requests will perform normally.

Apps that have more than 1 web dyno are never idled out. Workers dynos are never idled out.

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

enki42 posted:

Also, the migration setup is somewhat weird on Heroku - I'd really like to be able to do database migrations BEFORE deploying code (since 99% of the time they are additive, and code that doesn't know about the new columns will still happily work, whereas the converse is very rarely true.)

I suppose you could pull/migrate/push your db but that's not really a clean solution.

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

I'm having some trouble getting DateTime.strptime() to work properly. Getting "Argument Error (invalid date)"

code:
  def self.search(starts, ends)
    puts start #=> 9/27/2011 for example
    if starts && ends
      where( 'starts_at > ? AND ends_at < ?',
             DateTime.strptime('#{starts}', '%m/%d/%Y'), 
             DateTime.strptime('#{ends}', '%m/%d/%Y') )
    else
      after_today
    end
  end
Frustrating because it seems like it should be working!

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

skidooer posted:

In Ruby, single quoted strings are not parsed for interpolated variables. Not sure how necessary your conversion to string is, but keeping with the intent of your code:

code:
DateTime.strptime(starts.to_s, '%m/%d/%Y')
DateTime.strptime(ends.to_s, '%m/%d/%Y')

Thanks for the quick reply! I still have a lot to learn about this language.

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

NotShadowStar posted:

Here's me going on another tirade on you should learn the language first.

Does C# have this problem, people diving right into ASP.NET MVC without knowing a lick of C#?

Don't freak out, I'm very committed to learning Ruby standalone.

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

I have a scope-related question. I've implemented a many-to-many relationship in my app between categories and events. I want to be able to filter by a specific category. Here's the relevant code, (forgive me for its horribleness):

code:
class EventsController < ApplicationController
    @events = Event.date_filter(params[:from], params[:to])
                   .group_filter(params[:group])
                   .search(params[:keyword])
                   .order('starts_at')
                   .paginate(:page => params[:page], :per_page => 15 )
...
end

class Event < ActiveRecord::Base
  ...

  has_and_belongs_to_many :groups

  ...

  def self.group_filter(arg={})
    unless arg['group_id'].empty?
      g_id = arg['group_id']
      where 'group_ids = ?', g_id
    else
      scoped
    end
  end

end

schema.rb, join table:
  create_table "events_groups", :id => false, :force => true do |t|
    t.integer "event_id"
    t.integer "group_id"
  end

the specific error I'm getting is
code:
PGError: ERROR:  column "group_ids" does not exist
Right now everything seems to be in place but my group_filter scoping, specifically the line `where 'group_ids = ?', g_id`. There's no "group_ids" column obviously. I do have Event#group_ids method available though through the `has_and_belongs_to_many` method. How can I scope by category selection?

A MIRACLE fucked around with this message at 16:21 on Oct 14, 2011

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

Yeah taps is... kinda bad. Like, it breaks with RefineryCMS is you have any non-default settings set on the server, and then try to db:pull. You have to go into the console, manually delete the settings and then recreate them. Super annoying.

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

Doc Hawkins posted:

You'll want to install RVM first, before rubygems. See if that helps.

In an odd coincidence, lately I've been contributing to a set of instructions for that kind of thing.

If you have any problems with the Ubuntu section (besides it not giving working urls for the rubygems packages for 8.04 and 8.10), please let me know: we're going to walk a ton of people through this on Friday, and I want to get out in front of any mistakes or unclear bits.

Nice! But you might think about teaching Postgres if you're promoting Heroku.

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

NotShadowStar posted:

It doesn't really matter what RDBMS you're using as long as you stick to AR migrations. You can develop locally on sqlite and push to Heroku and Postgre without too much issue.

I've run into issues where my local sqlite queries ran fine, but imploded when I deployed to Heroku on postgres.

For example, a simple case-insensitive search
Works in SQLite:
code:
  def self.search(search)
    if search
      where('name LIKE ? OR description LIKE ?', "%#{search}%", "%#{search}%")
    else
      scoped
    end
  end
the same for Postgres:
code:
  def self.search(search)
    if search
      where('name ILIKE ? OR description ILIKE ?', "%#{search}%", "%#{search}%")
    else
      scoped
    end
  end
I like SQLite for it's portability (I never write very big apps). I'm open to suggestions as to how to make the same code behave on both databases.

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

Thanks guys :downs:

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

rugbert posted:

Is anyone still experiencing git push issues with heroku? I keep timing out but the support page says everything is fixed.

Not having any problems, pushed last night. Are you on Windows?

I would just open a ticket with support, they're usually good about getting back to you.

A MIRACLE fucked around with this message at 17:26 on Nov 22, 2011

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

I'm a noob help me.

I want my form select tags to retain their search parameters.

code:
# this works fine
text_field_tag :keyword, params[:keyword], :class => "form_field"

# this doesn't keep the param
select(params[:results_per_page], "results_per_page", ["10", "30", "100"])

# neither does this
select(params[:group_id], "group_id", Group.all.collect { |g| [raw(g.group_name), g.id] }, { :include_blank => true })

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

manero posted:


You're the man! The second example did the trick. I guess I'll learn to use select_tag instead of select in the future.

e: Anyone know how to escape the html `options_from_collection_for_select` produces? I'm getting some &-amp's in my options tags. I tried calling raw, html_safe on it to no avail.

A MIRACLE fucked around with this message at 22:48 on Dec 2, 2011

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

Oh man. I am having a hell of a time getting postgres running. It used to work fine... then I didn't use it for a while, now I'm getting the `server not listening error' ( OSX10.7 )
My pg_hba.conf and postgresql.conf check out fine.

Running `ps aux | grep postgres' shows that I DO have a server process running:
code:
$ ps aux | grep postgres
postgres       56925   0.0  0.0  2466492    844   ??  Ss    3:50PM   0:00.01 /sbin/launchd
root           56923   0.0  0.0  2469616   2096 s000  S     3:50PM   0:00.02 su - postgres
root           56922   0.0  0.1  2459500   2300 s000  S     3:50PM   0:00.03 sudo su - postgres
postgres       56976   0.0  0.0  2434892    444 s000  S+    3:53PM   0:00.00 grep postgres
postgres       56937   0.0  0.0  2468528   1212   ??  S     3:50PM   0:00.01 /usr/sbin/distnoted agent
postgres       56935   0.0  0.1  2489460   5624   ??  SN    3:50PM   0:00.07 
        /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Versions/A/Support/mdworker 
        -s mdworker -c MDSImporterWorker -m com.apple.mdworker.pool.0
postgres       56927   0.0  0.0  2435492    988 s000  S     3:50PM   0:00.02 -bash
Any ideas? VERY open to suggestions, ha.

e, oh yeah, here's what ActiveRecord throws:
code:
could not connect to server: Connection refused
	Is the server running on host "localhost" (127.0.0.1) and accepting
	TCP/IP connections on port 5432?
could not connect to server: Connection refused
	Is the server running on host "localhost" (::1) and accepting
	TCP/IP connections on port 5432?
could not connect to server: Connection refused
	Is the server running on host "localhost" (fe80::1) and accepting
	TCP/IP connections on port 5432?
e2, pg_ctl start doesn't work either
code:
Alexs-MacBook-Air:bin postgres$ ./pg_ctl start
pg_ctl: no database directory specified and environment variable PGDATA unset
Try "pg_ctl --help" for more information.

A MIRACLE fucked around with this message at 22:10 on Jan 4, 2012

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

BonzoESC posted:

Where'd you install postgres from? Lion comes with a psql client that doesn't work with homebrew postgres, and it's pretty expedient to sudo rm /usr/bin/psql /usr/bin/createdb /usr/bin/dropdb

Also what's your database.yml? Mine works with homebrew postgres and looks like this:
code:
development:
  adapter: postgresql
  database: triskelion-dev
  pool: 5
  timeout: 5000


Pretty generic:
code:
development:
  adapter: postgresql 
  database: db/development
  username: postgres
  host: localhost
  pool: 5
  timeout: 5000
About to leave work, I'll check out your suggestion when I get back.
`Running' 9.1, used the installer from PG's website IIRC.

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

Re: Postgres woes; cc: BonzoESC, Pardot

Well I'm an idiot and don't know how to read the output of ps, which led me to believe that postgres had an active server process (it didn't). Needless to say today has not been the most productive day as I am still struggling with launching the server.

So I do sudo su - postgres to run pg_ctl start, which tells me that I don't have PGDATA set as an env. variable. This is news to me as PG was running flawlessly a few weeks ago. But I digress, export PGDATA=/Library/Postgresql/9.1/data and continue. Then pg_ctl tells me that my data folder has too many permissions. More specifically
code:
FATAL:  data directory "/Library/PostgreSQL/9.1/data" has group or world access
DETAIL:  Permissions should be u=rwx (0700).
great. This is where I'm stuck. I ran chmod u=rwx /Library/PostgreSQL/9.1/data as both root and postgres to no avail, as in I still get the error. Any suggestions comments and or feedback are welcome. Thanks everybody.

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

BonzoESC posted:

Install postgres from homebrew, follow its instructions, call me in the morning.

Just got to this. Thanks man I'm good to go now.

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

Yeah, really wanted to go but filled up before I finalized my travel plans. Oh well.

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

Pretty much. Read up on .where if you're interested in returning collections.

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

What's the question, then? Rails is linking them behind the scenes using the inherited ActiveRecord and ActiveController classes. See your routes.rb for examples of invoking ActiveController methods.

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

I'm ready to kill myself. Okay not really but my friend/frontend dev guy did a pull request today where he basically rewrote our entire landing page, started using compass / blueprint, and now I'm running into problems with the asset pipeline deploying to heroku. It's gotten to the point where I'm ready to scrap the whole thing and redo it in Sinatra. Also I'm a little hung over because I got day-drunk at lunch, but still. Can anyone point me to info on the stylesheet link tree? I think that's where the problem is, like it's not precompiling a few stylesheets because they aren't in the tree or something. Here's what my log looks like:

code:
 ActionView::Template::Error (screen.css isn't precompiled):
2012-02-23T01:54:24+00:00 app[web.1]:   Rendered pages/home.html.haml within layouts/application (3.4ms)
2012-02-23T01:54:24+00:00 app[web.1]:     6:     -# Compass and blueprint stylesheets
2012-02-23T01:54:24+00:00 app[web.1]:     8:     = stylesheet_link_tag 'print', :media => 'print'
2012-02-23T01:54:24+00:00 app[web.1]:   app/views/layouts/application.html.haml:7:in 
`_app_views_layouts_application_html_haml___2737759042931766110_26806720'
Any help is appreciated.

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

How the hell do they do autocomplete for a dynamically-typed language? Didn't know that was possible. Is it reliable?

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

Splinter posted:

Mac users, what makes up your rails development environment?

* rvm, usually 1.9.3
* Rails 3.2
* Postgres
* Thin rails server thin
* Heroku
* Textmate
* git / Github
* Terminal

e: \/ pm sent! \/

A MIRACLE fucked around with this message at 23:30 on Feb 27, 2012

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

Sublime's cool, it also has a vi editor mode, was in a recent patch. You just hit esc and you're in vi mode. You have to enable it in the config first btw.

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

Physical posted:

Why is Vi worth using?

Some people like it? I think they added that feature to ease the transition for old school VIM users coming to a GUI editor. I know I had to break the habit of typing :w every time I wanted to save when I got my job writing C# in Visual Studio.

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

Physical posted:

Ok so this is kind of a rudimentry question but I am having a hard time dissecting it to do a fruitful google search.

I have a HighLazyChart object that I am trying to get the data array out of. Here is what I got so far.

code:
# ...
The code that generates that output is the following too lines
<%= @blah.inspect %>
<%= @blah.data.inspect %>

Now, I want access to the :data array in the @blah.data.inpsect line, the one with the 3,3,3,3,3 values in it. But @blah.data.data doesn't work and neither does @blah.data[:data] How the hell do I get access to that and also how do I do this in the future? How do I understand what the inspect dump is displaying and how to access the object data?

Um yeah it looks like LazyHighChart.data is an array object, as connoted by the [] operator wrapping it. So in this case you could try @data[0][:data] or even @data.first[:data].

Unless @data is going to point to a collection of hashes you might want to think about refactoring. But there's not enough code to tell.

Also use carriage returns when posting code please.

A MIRACLE fucked around with this message at 15:35 on Mar 20, 2012

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

That seems like a lot of work done in the view layer. Physical have you tried moving some of that logic to the model to see if that simplifies things a bit?

Adbot
ADBOT LOVES YOU

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

Yeah Physical, remember Fat Models, Skinny Controllers. Your controllers (in conjunction with the router) are basically for matching requests with the appropriate responses, no more.

e: any goon ops hiring Ruby devs right now? I'm thinking about leaving my .NET job and pursuing Ruby development full-time. And I wanna see what's out there...

A MIRACLE fucked around with this message at 23:38 on Mar 28, 2012

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