Re: [Radiant] Vapor extension clarification

2011-10-04 Thread Jim Gay
On Mon, Oct 3, 2011 at 10:08 PM, JT webmas...@webproductionsinc.com wrote:
 Hi all,

 Two questions related to the Vapor extension...

 1 - If I manually add an entry to the flow_meters table in my MySQL
 database, how come that redirect does not take effect on my site? Even
 restarting radiant doesn't seem to get the redirect to take effect.

It should. Is the format correct? Have you verified that your regular
expressions are correct?

If you are using regular expressions, Vapor will gather them all, sort
them, reverse them, and then loop through the collection. The
collection is sorted and reversed so that it will attempt to match the
more specific regular expressions first.


 2 - Is there a maximum number of redirects I can have? I have a
 radiant installation that's got a lot of redirects set up (240 at the
 moment), and most of the latest entries are not redirecting. The
 database design and the UI seem to imply I can have an unlimited
 number of redirects set up.

There is no explicit maximum.


 Thanks,

 JT


Please let me know if you find a bug.


-- 
Jim Gay
Saturn Flyer LLC
http://www.saturnflyer.com
571-403-0338


[Radiant] Rake Task

2011-10-04 Thread Hadi S.
Hi,

I need to create some pages in a rake task. For what attributes i have
to watch out?
I already implemented the rake task but can't save pages inside it,
because the page is invalid. I think because the slug and breadcrumb
attributes are not set. Where does the slug and breadcrumb default
attributes get set in the radiant source code?


Re: [Radiant] Rake Task

2011-10-04 Thread Jim Gay
On Oct 4, 2011, at 6:54 AM, Hadi S. poph...@gmail.com wrote:

 Hi,
 
 I need to create some pages in a rake task. For what attributes i have
 to watch out?
 I already implemented the rake task but can't save pages inside it,
 because the page is invalid. I think because the slug and breadcrumb
 attributes are not set. Where does the slug and breadcrumb default
 attributes get set in the radiant source code?

Start by writing a test for some object that will do this. Make a PageCreator 
or something and write the methods in there. Then, in your rake task, call the 
methods on that well tested object.

If you want to just handle it in your task (you shouldn't, because it's harder 
to verify that your code is correct) then at least check to see if the pages 
you create are valid? and then handle any errors. 

But there are no default slug or breadcrumb settings. In the admin UI there is 
JS that will watch what you type for the title and automatically set those 
fields for you. Open the new page form in the web UI and click the more link to 
see those fields. Then begin typing a title and you'll see slug and breadcrumb 
automatically filled in. You don't have this JS in your rake task. 

Another option is to just reopen the Page class in your code and add defaults 
like this:

Page.class_eval do
  before_save :set_my_defaults
  def set_my_defaults
# your code
  end
end

But if you don't write tests, you might make incorrect assumptions about your 
program. For example, you might assume that you can save without setting a slug 
or breadcrumb ;-)

Does this help?

-Jim