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
Flobbster
Feb 17, 2005

"Cadet Kirk, after the way you cheated on the Kobayashi Maru test I oughta punch you in tha face!"

wunderbread384 posted:

Edit: Also, is the method private maybe? I would imagine Rails should throw an error if that happens but many things in Rails don't happen the way I imagine.

Nope, it's public, but that got me fooling around a little more. On a whim, I renamed my "display" action to "enlarge", updated the routes and all the other references, and it works now!

What I didn't realize at the time is that Ruby already has an Object#display method, which I would have to guess is what caused the problem. A lot of trouble for nothing, apparently.

Adbot
ADBOT LOVES YOU

phazer
May 14, 2003

chirp chirp i'm a buffalo
The TinyMCE ~/vendor/plugin folder seems to come with basically the same folders it puts in the ~/public directory. Is it safe to delete anything out of there? It slows down and usually times out FTP and SVN transfers.

Operation Atlas
Dec 17, 2003

Bliss Can Be Bought

Flobbster posted:

I'll rename it "enlarge", so we stop getting hung up on the synonym and overlooking the actually problem here, which is why an action method isn't getting called.

You know what, that would fix it. "display" is a preexisting method in ActionController.

Edit: Oh, there was a new page I didn't see and you found that out already. Awesome.

phazer
May 14, 2003

chirp chirp i'm a buffalo
Having a weird problem with drag & drop sortable lists--

I have two lists, one of categories and one of pages, with the following code:

code:
#controller
def update_category_sort_order
  	  params[:sortable_category_list].each_with_index do |id, category_order|
    	Category.update(id, :category_order => category_order)
  	  end
 	  render :nothing => true
  end

def update_page_sort_order
  	  params[:sortable_page_list].each_with_index do |id, page_order|
    	Page.update(id, :page_order => page_order)
  	  end
 	  render :nothing => true
  end


#view

#list_categories
<ul id="sortable_category_list">
<% @categories.each do |category| %>
<li id="item_<%= category.id %>"><%= category.title %></li>
	<% end -%>
</ul>

<%= sortable_element 'sortable_category_list', 
:complete => visual_effect(:highlight, 'sortable_category_list'), 
:url => { :action => "update_category_sort_order" } %>

/*-----------------------*/

#list_pages
<ul id="sortable_page_list">
<% @pages.each do |page| -%>
	<li id="item_<%= page.id %>"><%= page.title %></li>
<% end -%>
</ul>

<%= sortable_element 'sortable_page_list', 
:complete => visual_effect(:highlight, 'sortable_page_list'),
:url => { :action => "update_page_sort_order" } %>

It works PERFECT. I drag and drop my categories around and the order is updated in the db.
BUT when I drag and drop my pages around, the UI changes, but the DB is not updated.

This happens in my development.log:
code:
Processing AdminController#update_page_sort_order (for 127.0.0.1 at 2008-12-20 13:59:40) [POST]
  Session ID: blah

  Parameters: {"authenticity_token"=>"blah", 
       "action"=>"update_page_sort_order", 
       "controller"=>"admin", 
       "sortable_page_list"=>["6", "7"]}

  User Columns (0.004094)   SHOW FIELDS FROM `users`
  User Load (0.001015)   SELECT * FROM `users` WHERE (`users`.`id` = 1) LIMIT 1
  Page Columns (0.003432)   SHOW FIELDS FROM `pages`
  Page Load (0.000692)   SELECT * FROM `pages` WHERE (`pages`.`id` = 6) 
  SQL (0.000259)   BEGIN
  SQL (0.000450)   SELECT `page_order` FROM `pages` WHERE (`pages`.page_order = 0 AND `pages`.id <> 6) 
  SQL (0.000243)   COMMIT
  Page Load (0.000572)   SELECT * FROM `pages` WHERE (`pages`.`id` = 7) 
  SQL (0.000247)   BEGIN
  SQL (0.001074)   SELECT `page_order` FROM `pages` WHERE (`pages`.page_order = 1 AND `pages`.id <> 7) 
  SQL (0.000258)   COMMIT
Completed in 0.17403 (5 reqs/sec) | Rendering: 0.00057 (0%) | 
DB: 0.01234 (7%) | 200 OK [http://localhost/admin/update_page_sort_order]
For reference, here's what the category update looks like:
code:
Processing AdminController#update_category_sort_order (for 127.0.0.1 at 2008-12-20 13:57:54) [POST]
  Session ID: blah
  Parameters: {"sortable_category_list"=>["3", "7", "1", "9", "11", "13", "5", "15"], 
            "authenticity_token"=>"blah", 
            "action"=>"update_category_sort_order", 
            "controller"=>"admin"}
  User Columns (0.004254)   SHOW FIELDS FROM `users`
  User Load (0.001118)   SELECT * FROM `users` WHERE (`users`.`id` = 1) LIMIT 1
  Category Columns (0.003871)   SHOW FIELDS FROM `categories`
  Category Load (0.000868)   SELECT * FROM `categories` WHERE (`categories`.`id` = 3) 
  SQL (0.000750)   BEGIN
  Category Load (0.000918)   SELECT * FROM `categories` WHERE 
(`categories`.`parent_id` = 3 AND `categories`.`thumbnail` = 'thumb') LIMIT 1

  Category Update (0.000333)   UPDATE `categories` SET `updated_at`
 = '2008-12-20 18:57:54', `size` = 73420 WHERE `id` = 4

  SQL (0.001223)   COMMIT
  Category Load (0.000894)   SELECT * FROM `categories` WHERE (`categories`.`id` = 7) 
  SQL (0.000209)   BEGIN
  Category Load (0.001062)   SELECT * FROM `categories` WHERE (`categories`.`parent_id` 
= 7 AND `categories`.`thumbnail` = 'thumb') LIMIT 1

  SQL (0.000207)   COMMIT
  Category Load (0.001248)   SELECT * FROM `categories` WHERE (`categories`.`id` = 1) 
  SQL (0.002056)   BEGIN
  Category Update (0.000441)   UPDATE `categories` SET `updated_at` = '
2008-12-20 18:57:55', `size` = 100583 WHERE `id` = 1

  Category Load (0.001029)   SELECT * FROM `categories` WHERE
 (`categories`.`parent_id` = 1 AND `categories`.`thumbnail` = 'thumb') LIMIT 1

  Category Update (0.000791)   UPDATE `categories` SET `updated_at` = 
'2008-12-20 18:57:55', `size` = 100609 WHERE `id` = 2

  SQL (0.001604)   COMMIT
  Category Load (0.001753)   SELECT * FROM `categories` WHERE (`categories`.`id` = 9) 
  SQL (0.000213)   BEGIN
  Category Load (0.001109)   SELECT * FROM `categories` WHERE (`categories`.`parent_id` 
= 9 AND `categories`.`thumbnail` = 'thumb') LIMIT 1

  SQL (0.000269)   COMMIT
  Category Load (0.000826)   SELECT * FROM `categories` WHERE (`categories`.`id` = 11) 
  SQL (0.000212)   BEGIN
  Category Update (0.001362)   UPDATE `categories` SET `updated_at` = '2008-12-20 18:57:55', 
`size` = 85504 WHERE `id` = 11

  Category Load (0.000850)   SELECT * FROM `categories` WHERE (`categories`.`
parent_id` = 11 AND `categories`.`thumbnail` = 'thumb') LIMIT 1

  Category Update (0.000396)   UPDATE `categories` SET `updated_at` = '2008-12-20 18:57:55', 
`size` = 85505 WHERE `id` = 12

  SQL (0.001521)   COMMIT
  Category Load (0.001990)   SELECT * FROM `categories` WHERE (`categories`.`id` = 13) 
  SQL (0.000213)   BEGIN
  Category Update (0.000448)   UPDATE `categories` SET `category_order` = 5, `updated_at` 
= '2008-12-20 18:57:55', `size` = 81690 WHERE `id` = 13

  Category Load (0.001628)   SELECT * FROM `categories` WHERE (`categories`.`parent_id` = 
13 AND `categories`.`thumbnail` = 'thumb') LIMIT 1

  Category Update (0.000396)   UPDATE `categories` SET `updated_at` = '2008-12-20 18:57:55', 
`size` = 81693 WHERE `id` = 14

  SQL (0.013923)   COMMIT
  Category Load (0.001111)   SELECT * FROM `categories` WHERE (`categories`.`id` = 5) 
  SQL (0.000229)   BEGIN
  Category Update (0.000464)   UPDATE `categories` SET `category_order` = 6, `updated_at` 
= '2008-12-20 18:57:55' WHERE `id` = 5

  Category Load (0.000812)   SELECT * FROM `categories` WHERE (`categories`.`parent_id` 
= 5 AND `categories`.`thumbnail` = 'thumb') LIMIT 1

  Category Update (0.000369)   UPDATE `categories` SET `updated_at` = '2008-12-20 18:57:55', 
`size` = 56334 WHERE `id` = 6

  SQL (0.001360)   COMMIT
  Category Load (0.001393)   SELECT * FROM `categories` WHERE (`categories`.`id` = 15) 
  SQL (0.000265)   BEGIN
  Category Load (0.001197)   SELECT * FROM `categories` WHERE (`categories`.`parent_id` 
= 15 AND `categories`.`thumbnail` = 'thumb') LIMIT 1

  SQL (0.000210)   COMMIT
Completed in 1.60646 (0 reqs/sec) | Rendering: 0.00049 (0%) 
| DB: 0.05739 (3%) | 
200 OK [http://localhost/admin/update_category_sort_order]
(various line breaks added to fix table breakage)

As you can see, the UPDATE command is missing for the pages section, and it's instead doing some weird select where clause that says id <> 6 or 7 depending on the id

phazer fucked around with this message at 02:08 on Dec 21, 2008

Operation Atlas
Dec 17, 2003

Bliss Can Be Bought

phazer posted:

How do I put links in a boolean output? Can I? There must be a way.

I prefer to do

code:
<%= link_to_deactivate_here if category.active? %>
<%= link_to_activate_here unless category.active? %>

phazer
May 14, 2003

chirp chirp i'm a buffalo

Praetorian42 posted:

I prefer to do

code:
<%= link_to_deactivate_here if category.active? %>
<%= link_to_activate_here unless category.active? %>

I ended up going with this (I got some help on the IRC channel):

code:
<%= link_to category.active? ? "Deactivate" : "Activate", { 
       :action => category.active? ? "deactivate_category" : "activate_category",
       :id => category.id 
    }, :class => 'lnk_active' %>
Thanks, though!

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
I have an Entries model and I have a Votes model. Each Entry has many Votes and each time that an Entry is loaded, the associated Votes will also need to be loaded, is there a way I can use scope to automatically :include => :votes on each request?

Or is this not good practice?

Evil Trout
Nov 16, 2004

The evilest trout of them all

Nolgthorn posted:

I have an Entries model and I have a Votes model. Each Entry has many Votes and each time that an Entry is loaded, the associated Votes will also need to be loaded, is there a way I can use scope to automatically :include => :votes on each request?

Or is this not good practice?

In Edge rails, there's now default scoping: http://ryandaigle.com/articles/2008/11/18/what-s-new-in-edge-rails-default-scoping

Although if you aren't running Edge, you might want to just create a named_scope that does it, and just make sure you always use that named_scope when accessing your entries.

Hammertime
May 21, 2003
stop

Nolgthorn posted:

I have an Entries model and I have a Votes model. Each Entry has many Votes and each time that an Entry is loaded, the associated Votes will also need to be loaded, is there a way I can use scope to automatically :include => :votes on each request?

Or is this not good practice?

Honestly, it's not good practice.

Evil Trout's suggestion is better though. I think it's pretty important to be able to see the eager loaded tables (or at least scopes that suggest something funny's going on) at first glance for every ActiveRecord find call.

code:
class Entry
  has_many :votes
  named_scope :with_votes, :include => :votes
code:
Entry.with_votes.all :order => "created_at DESC", :limit => 10

skidooer
Aug 6, 2001

phazer posted:

I ended up going with this
If I am correctly inferring what you are trying to do, you might want to reconsider your use of GET.

Edit: I think this is a little nicer to read, also.
code:
<span class="activation-link">
  <% link_to category_path(category, :active => !category.active?), :method => :put do %>
    <%= category.active? ? 'Deactivate' : 'Activate' %>
  <% end %>
</span>

skidooer fucked around with this message at 06:09 on Dec 22, 2008

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
Thanks for the advice, I am using named_scope now.


I have some restful routes in my application, shorthand it looks like this.
code:
  map.resources :entries
  map.root :controller => 'entries'
Now in my application if I call entries_path the result is a link to /entries when what I really want is to go to / instead. The path /entries should never really come up unless I've specified a entry_id, is there a way for me to tell Rails that the shorter url takes priority?

Before I started using rest Rails was good at picking the shortest url because I would always put the shorter urls lowest in the order.

Or do I have to start explicitly using root_path instead?

Nolgthorn fucked around with this message at 04:53 on Dec 23, 2008

skidooer
Aug 6, 2001

Nolgthorn posted:

The path /entries should never really come up unless I've specified a entry_id, is there a way for me to tell Rails that the shorter url should take priority?
code:
map.resources :entries
with_options :controller => 'entries' do |entries_map|
  entries_map.entries '/', :action => 'index', :conditions => { :method => :get }
  entries_map.entries '/', :action => 'create', :conditions => { :method => :post }
end

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
That didn't really seem to fix it, my routes are a bit more verbose, let me post in more detail including your suggestion I'm still getting directed to /entries with entries_path.

code:
  map.resources :entries, :except => [:show],
      :member => {:promote => :get, :promote_top => :get, :demote => :get, :confirm_destroy => :get}, 
      :collection => {:admin => :get, :upcoming => :get},
      :shallow => true do |entry|
    entry.entries '/', :controller => 'entries', :action => 'index', :conditions => {:method => :get}
    entry.resources :comments, :member => {:confirm_destroy => :get}
  end
  map.date ':year/:month/:day', :requirements => {:year=>/\d{4}/,:month=>/\d{1,2}/,:day=>/\d{1,2}/},
      :controller => 'entries', :action => 'show'

  map.root :controller => 'entries'

skidooer
Aug 6, 2001

Nolgthorn posted:

That didn't really seem to fix it
To be fair, you didn't follow my code example. ;)

Redefine entries outside of the resources block.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
True,

I'm getting this error: "undefined method `entries' for main:Object" line starting with "with_options" and the one right below it.

With this code:
code:
  map.resources :entries, :except => [:show],
      :member => {:promote => :get, :promote_top => :get, :demote => :get, :confirm_destroy => :get}, 
      :collection => {:admin => :get, :upcoming => :get},
      :shallow => true do |entry|
    entry.resources :comments, :member => {:confirm_destroy => :get}
  end
  with_options :controller => 'entries' do |entries_map|
    entries_map.entries '/', :action => 'index', :conditions => {:method => :get}
    entries_map.entries '/', :action => 'create', :conditions => {:method => :post}
  end

skidooer
Aug 6, 2001

Nolgthorn posted:

I'm getting this error: "undefined method `entries' for main:Object" line starting with "with_options" and the one right below it.
I guess I lost some code in transit. It should read: map.with_options ...

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
Well I'll be, that works. Incredible that it does, confuses me a lot. Thanks.


Edit: also I was able to cram my map.root in there too.
code:
  map.with_options :controller => 'entries' do |entries_map|
    entries_map.entries '/', :action => 'index', :conditions => {:method => :get}
    entries_map.entries '/', :action => 'create', :conditions => {:method => :post}
    entries_map.root
  end

Nolgthorn fucked around with this message at 05:33 on Dec 23, 2008

phazer
May 14, 2003

chirp chirp i'm a buffalo
Augh more problems, of course.

OKAY this one is a doozie to me:

I've got this guy going on:

code:
#view:
<p>
   <label for="entries_entry_type_id">Entry Type:</label><br />
   <%= f.select('entry_type_id', @entry_types, 
       {:include_blank => 'Choose a Type...'}) %><br />
</p>

<div id="products" class="entry-type">
   Products List Will Be Here
</div>

<%= observe_field :entries_entry_type_id, 
	     	:url => { :action => :display_entry_type_fields },
      		:with => 'entry_type_id'
 %>

#controller:
def display_entry_type_fields
    render :update do |page|
      page.alert 'Hello World'
      page.show 'products'
    end
end
And when I change the select field, I get the "Hello World" alert (as a test to make sure it's working) but the div does not display. No clue. Here's the log output:

code:
Processing ProfileController#display_entry_type_fields 
(for 127.0.0.1 at time) [POST]
  Parameters: {"entry_type_id"=>"1",
 "authenticity_token"=>"blah"}
  SQL (0.2ms)   SET NAMES 'utf8'
  SQL (0.1ms)   SET SQL_AUTO_IS_NULL=0
Completed in 2ms (View: 0, DB: 0) | 
200 OK 
[[url]http://localhost/profile/display_entry_type_fields[/url]]

skidooer
Aug 6, 2001

phazer posted:

And when I change the select field, I get the "Hello World" alert (as a test to make sure it's working) but the div does not display. No clue.
Are you including prototype.js? Also, I have to ask, why aren't you using named routes?

narbsy
Jun 2, 2007
Also you don't have to write the html for labels. There is a label method provided in rails for the convenience. Just a style thing.

Operation Atlas
Dec 17, 2003

Bliss Can Be Bought

phazer posted:

No clue.

Look at the Javascript that Rails is pumping out, and see what's wrong with that.

I hate RJS for just this reason.

Operation Atlas
Dec 17, 2003

Bliss Can Be Bought
So... Merb and Rails are to merge for Rails 3. Thoughts, everyone?

Personally, I'm kind of pissed off. There's a reason I stopped developing in Rails and moved over to Merb. The way Rails handles rendering is enough to make me hate the thought of going back.

dustgun
Jun 20, 2004

And then the doorbell would ring and the next santa would come
I was just about to start playing with merb today but now it feels horribly moot :(

Pardot
Jul 25, 2001




Praetorian42 posted:

So... Merb and Rails are to merge for Rails 3. Thoughts, everyone?

Personally, I'm kind of pissed off. There's a reason I stopped developing in Rails and moved over to Merb. The way Rails handles rendering is enough to make me hate the thought of going back.

Yeah we'll see how it goes. If it ends up being the best of the two, that'll be great.

From what I've talked to people, Rails is going to be like Merb, where the default stack is just going to be the current Rails stack. But you could swap out AR for datamapper, or you could easily switch to jquery without extra plugins like you need today.

For rails, they get some smart people on the team from merb, and don't have to worry about merb killing them. For merb, they get, what, name recognition? I don't really see how this move helps the merb team.

Operation Atlas
Dec 17, 2003

Bliss Can Be Bought

Pardot posted:

Yeah we'll see how it goes. If it ends up being the best of the two, that'll be great.

From what I've talked to people, Rails is going to be like Merb, where the default stack is just going to be the current Rails stack. But you could swap out AR for datamapper, or you could easily switch to jquery without extra plugins like you need today.

For rails, they get some smart people on the team from merb, and don't have to worry about merb killing them. For merb, they get, what, name recognition? I don't really see how this move helps the merb team.

I'm all in favor of choice, but since I already had that with Merb, I don't really gain anything.

I'm not sure why this is good for Merb, either. I, personally, didn't see the competition between the two frameworks as a bad thing.

dustgun posted:

I was just about to start playing with merb today but now it feels horribly moot :(

It might actually benefit to start learning Merb. It'll get you prepared for Rails 3, which, after reading more, might be very heavily impacted by the Merb merge.

Overall, this seems like it is great for Rails people and "Meh?" for Merb people. I haven't seen a Merb person (aside from the Core team) who is particularly excited about this.

phazer
May 14, 2003

chirp chirp i'm a buffalo

skidooer posted:

Are you including prototype.js? Also, I have to ask, why aren't you using named routes?

I am definitely including prototype, because the alert("hello world") works, and the log shows the action being called from the controller, with the correct parameters. For some reason page.show 'products' isn't working.

Also, I'm still a big time noob so I'm not using named routes because I'm not even sure what you mean. :( I mean, I know how to look it up and figure it out, but it's going to take time, it's not what I'm used to (I started on the tutorials for 1.2)

I figured it out. It can't overwrite my CSS (display:none;) So I need to hide it with prototype on load, too. No big.

Now my problem is I have If conditionals powering which DIV element to show depending on what's selected. According to my log, my parameter is :entry_type_id so I would think this would work:
code:
page.show 'products' if params[:entry_type_id] == 1
But it doesn't. I'm sure it's a dumbass noob move, but I learn every time I do something dumb, so whatever.

phazer fucked around with this message at 22:37 on Dec 23, 2008

skidooer
Aug 6, 2001

phazer posted:

so I would think this would work: But it doesn't.
params[:entry_type_id] will be a string unless you convert it to another type. Try this instead:
code:
params[:entry_type_id] == '1'

phazer
May 14, 2003

chirp chirp i'm a buffalo

skidooer posted:

params[:entry_type_id] will be a string unless you convert it to another type. Try this instead:
code:
params[:entry_type_id] == '1'

Awwwwwweeesome! Thanks!

skidooer
Aug 6, 2001

Praetorian42 posted:

I, personally, didn't see the competition between the two frameworks as a bad thing.
I do not see the benefit of continuing the separation between projects. As I read it, Merb will become Rails-core. Rails-flat will implement Rails on top of Merb, so to speak. The philosophies of both projects should remain, while eliminating the duplication of efforts.

Competition helps in business because there is a benefit to having more customers than the next guy. There is no real benefit to having more "customers" than the other guy when your product is free, and freely available to be modified.

dustgun
Jun 20, 2004

And then the doorbell would ring and the next santa would come

Praetorian42 posted:

It might actually benefit to start learning Merb. It'll get you prepared for Rails 3, which, after reading more, might be very heavily impacted by the Merb merge.
My plan is basically to keep on top of edge, and keep the apps I work on up-to-date with the changes.

quote:

Overall, this seems like it is great for Rails people and "Meh?" for Merb people. I haven't seen a Merb person (aside from the Core team) who is particularly excited about this.
It's validation that they were right about their architecture

phazer
May 14, 2003

chirp chirp i'm a buffalo
I am using attachment_fu with ImageMagick/RMagick and I have this code in my photo model:

code:
class Photo < ActiveRecord::Base
	has_attachment 	:content_type => :image, 
                 	:storage => :file_system, 
                 	:max_size => 1.megabyte,
                 	:resize_to => '700x466>',
                 	:thumbnails => { 
                 		:thumb => '150x150>',
                 		:cropped => '70x70!' }
					
	validates_as_attachment
end
I have the same exact code in my model on my production server and it makes proper 70x70 cropped thumbnails. But on my local copy (both using rails 2.1), the cropped version is just a resize, and it distorts the picture. Anyone have any ideas? I did rewrite the application on my local copy, but I copied this model exactly.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
Fairly certain that attachment_fu still doesn't support cropping due to the vast differences between the many image processors out there. You may have a modified version of the plugin that is only designed to work with some processors and may be running on a different one by default in production.

Try this:
code:
class Photo < ActiveRecord::Base
	has_attachment 	:content_type => :image, 
                 	:storage => :file_system, 
                 	:max_size => 1.megabyte,
                 	:resize_to => '700x466>',
                 	:thumbnails => { 
                 		:thumb => '150x150>',
                 		:cropped => '70x70!',
                        :processor => :rmagick }
					
	validates_as_attachment
end
Merry Christmas!

Pardot
Jul 25, 2001




This is by far the best article on Rails 3 Merb/Rails merge, or Why should merbists be happy?, and it's answered all of the questions I had about what was in it for merb.

I'm pretty excited now. What I'd like to see most, I think, is a big step forward from each framework. Even if it will break a lot of existing stuff and plugins. Sorta like the difference between os 9 and X.

If there's going to be a clean merb-style API, there could maybe be some sort of transition API on top of that to ease old apps into Rails 3, whereas new apps wouldn't need it.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

Pardot posted:

This is by far the best article on Rails 3 Merb/Rails merge, or Why should merbists be happy?, and it's answered all of the questions I had about what was in it for merb.

Why is it important to maintain any semblance of plugin backwards-compatibility? Generally if you're developing a Rails application, you use the latest version and go to production when it's done using whatever version you started with, unless there is a feature you absolutely need you wouldn't update it.

I would imagine there is a lot of code that could be different or that is different in Merb, why keep all these old methods? Isn't that all the opposite of trimming down the bloat Rails has been accumulating and the opposite of making it run faster?

Edit: Ohhh they're just talking about a public API for plugin functionality... ok I guess.

I really hope they bring Merb's slices.

Nolgthorn fucked around with this message at 11:29 on Dec 26, 2008

phazer
May 14, 2003

chirp chirp i'm a buffalo

Nolgthorn posted:

Fairly certain that attachment_fu still doesn't support cropping due to the vast differences between the many image processors out there. You may have a modified version of the plugin that is only designed to work with some processors and may be running on a different one by default in production.


The exact same plugin, image processor and model/code works on my other copy of the application though.

Example:

On my production server:


On my local copy:


The only difference is on my production copy I'm doing 75x75! instead of 70x70! Everything else is the same: model/code, plugin, img processor. The production copy STARTED on my local box and worked then, too.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
I still think you would benefit by specifying the image processor you want if you're going to be using cropping.

phazer
May 14, 2003

chirp chirp i'm a buffalo

Nolgthorn posted:

I still think you would benefit by specifying the image processor you want if you're going to be using cropping.

It did not help. I don't know what's up with it. Really sucks though because his thumbnails look like crap and that's no good for a photography portfolio.

palatka
Apr 4, 2003

by Ralp
I have been working on a Rails contract for the past year but it's coming to an end in January and there are no other local jobs. What are you guys doing for work? Where are places to look for work online?

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.

Nolgthorn posted:

Why is it important to maintain any semblance of plugin backwards-compatibility? Generally if you're developing a Rails application, you use the latest version and go to production when it's done using whatever version you started with, unless there is a feature you absolutely need you wouldn't update it.

I would imagine there is a lot of code that could be different or that is different in Merb, why keep all these old methods? Isn't that all the opposite of trimming down the bloat Rails has been accumulating and the opposite of making it run faster?

Edit: Ohhh they're just talking about a public API for plugin functionality... ok I guess.

I really hope they bring Merb's slices.
That's fine for applications that have active maintainers. For applications that don't, and need to stay in lock-step with security updates to the platform, breaking everything possible on a new release is kind of nightmarish for system administrators, who might have the good sense and Ruby knowledge to migrate small apps to the new framework, but have no interest in completely rewriting all plugin-provided functionality. Rails doesn't exactly have the best track record of backporting security fixes to prior releases once a new one is out.

Vulture Culture fucked around with this message at 21:18 on Dec 27, 2008

Adbot
ADBOT LOVES YOU

phazer
May 14, 2003

chirp chirp i'm a buffalo

phazer posted:

It did not help. I don't know what's up with it. Really sucks though because his thumbnails look like crap and that's no good for a photography portfolio.

UGH, I realized what it is. I looked up how to do cropped thumbnails with attachment_fu/rmagick, and I remembered I found this, which makes you rewrite the processor code:

Crop Images using Attachment_Fu/rMagick

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