Radhames Brito wrote:
[...]
>> And veeeeery wrong.  The database should store the whole block of text.
>> The view and controller should decide how to split it.  This makes the
>> presentation more flexible: what if you want short pages on the mobile
>> phone, long pages on the computer, and whole articles in the RSS feed?
>>
>
> I dont care about how to create the solution i just want the result ,
> that i
> could have my view
> of one specific size and paginate the text, i dont care how is done i
> just
> want a gem to do it,
> right now i am using ajax for this.

I don't see why you need Ajax here.  What I think you want -- and I've
never done this, so I could be wrong -- is something like this:

class Article
  def paginate(format = :web)
    case format
      when :web
        content.in_big_chunks
      when :mobile
        content.in_smaller_chunks
      when :rss
        content
    end
  end
end

class ArticlesController
  def show
    @paginated_content = Article.find(params[:id]).paginate(:web)

    # then use will_paginate or something to display all the pages
  end
end

That's if you really want to do this at all.  In most cases, I believe
that splitting an article into multiple pages on the Web is poor UI
design.  If it's one article, I'd much rather read it on one long page
than 10 short ones.

>
>
>
>> Why do you think I know how to do this? :)  I'm just starting to write
>> my first AR plugin.
>>
>> Because you are very active  in the forum and have been programing ruby
> longer than me =).
> Where are you getting the info for your plugin? how are you figuring out
> how
> to do it? right now
> i jsut look at other polugins but reverse engineering is not fun.

Same way I learn anything else in Rails: read the rdoc and search the
Web for whatever information I can find.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to