Re: [Radiant] Vapor extension clarification
On Mon, Oct 3, 2011 at 10:08 PM, JT 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
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
On Oct 4, 2011, at 6:54 AM, "Hadi S." 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
[Radiant] Re: Vapor extension clarification
On Oct 4, 5:29 am, Jim Gay wrote: > On Mon, Oct 3, 2011 at 10:08 PM, JT 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. This may have been user error. I programatically inserted a large number of records into the flow_meters table, and then restarted radiant. However, the catch URLs were of the format: /my-parent-page#some-anchor /my-parent-page#some-other-anchor I was trying to have it identify and redirect based on the anchor name, which I presume is not possible. I was not using regular expressions. > > 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. The problem here seems to have been local browser cache, as the redirects are working nicely now. Thanks, JT
Re: [Radiant] Re: Vapor extension clarification
On Oct 4, 2011, at 10:55 AM, JT wrote: > > > On Oct 4, 5:29 am, Jim Gay wrote: >> On Mon, Oct 3, 2011 at 10:08 PM, JT 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. > > This may have been user error. > > I programatically inserted a large number of records into the > flow_meters table, and then restarted radiant. However, the catch URLs > were of the format: > > /my-parent-page#some-anchor > /my-parent-page#some-other-anchor > > I was trying to have it identify and redirect based on the anchor > name, which I presume is not possible. AFAIK, the anchor is not even sent to the server -- it's part of the local browser's job to follow that "last mile" within the page. Walter > > I was not using regular expressions. > >>> 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. > > The problem here seems to have been local browser cache, as the > redirects are working nicely now. > > Thanks, > > JT